This line: $("input").parent("div").css("background", "url(images/div_bg.png)"
is causing all of the other items to reset to normal, allowing you to only have 1 active state at a time. You could scope it to the row so that each row may have one item selected.
A:
Mark Hurd
2009-09-09 21:21:24
"You could scope it to the row so that each row may have one item selected." - How do I do that ? tnx
c0mrade
2009-09-09 21:39:47
A:
You're only assigning behavior to the item clicked, rather than all selected input boxes. You might want to make a function as such:
function foo()
{
$('input :selected').css(bar);
}
Now whenever you get a click event on an input event, call bar. You may need to modify foo to meet your specifications.
Stefan Kendall
2009-09-09 21:21:56
This seems to partially work, thank you , I guess I forgot to mention that only 1 radio can be selected per row therefore also one div in a row can change background I modified code slightly as you suggested $("input").click(function() { $('input :selected').parent("div").css("background", "url(images/div_bg.png)"); $(this).parent("div").css("background", "url(images/div_bg_hover.png)");anything else you recommend ?
c0mrade
2009-09-09 21:31:48
+3
A:
What is the purpose of your second line of jquery?
$("input").parent("div").css("background", "url(images/div_bg.png)");
This is going to reset the background of all the "entry" divs. If I understand your objective correctly I think you want:
$(this).parent("div").siblings("div.entry").css("background", "url(images/div_bg.png)");
That way only the siblings of the entry you are changing will get their backgrounds reset.
On a side note, you have multiple divs with the same id, which is not a good idea.
Joel Potter
2009-09-09 21:24:25