Hi,
I have a "checklist" comprised of 8 checkboxes in a table, all with the
class "checklist".
I'm pulling the values from a database, and I want to highlight the
containing TDs green for the checkboxes that are checked, and leave the rest
alone.
I can do this onclick:
$(".checklist").click(function(){
($(this)[0].checked) ?
($(this).parent().css("background","lightgreen")) :
($(this).parent().css("background","none"));
});
But I can't seem to do it on document load (when it's pulled vals from the
db).
This doesn't do anything (nor does it produce a Firebug error):
if ( $(".checklist").is(":checked") ) {
($(this)[0].checked) ?
($(this).parent().css("background","lightgreen"))
: ($(this).parent().css("background","none"));
}
Advice?
Thanks,
________
SEAN O
--
View this message in context:
http://www.nabble.com/how-to-tell-if-checkbox-is-checked-and-manipulate-tf3082108.html#a8563552
Sent from the JQuery mailing list archive at Nabble.com.
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/