Here is a snippet of my HTML table:
Name | Size | Modified | |
Folder | 1.0 KB | Dec. 28, 2011, 3:41 p.m. | |
This is a new folder for the new project | 53 bytes | Jan. 3, 2012, 5:05 a.m. |
And here is the accompanying JQuery:
$("tr").click(function(){ var checkbox = $(this).children().children("input"); checkbox.attr("checked", !checkbox.attr("checked")); });
The code finds the correct checkbox using the $(this) property provided by the event and the children() selector. Two children calls are necessary, first for the children of the TR, then for the children of the TD, this last one is specified to be the "input" child. The toggle is achieved by setting the "checked" attribute of the checkbox to the opposite of whatever it is currently set at, !$(checkbox).attr("checked");. Simple, love it!
Great post and a very helpful tutorial .
ReplyDeleteThanks a lot for sharing this with us,it helped us a lot.
JQuery training in Bangalore
Casino: Why is gambling the most dangerous of all
ReplyDeleteA casino gambling addict is simply gambling the most dangerous of gri-go.com all herzamanindir.com/ other people. A gambler's life is not just about the outcome 1xbet 먹튀 of apr casino an worrione action,
Thanks for sharing such an useful and informative blog post.
ReplyDeletealso, join Java course in Pune
Thank you for sharing such a really admire your post. Your post is great!
ReplyDelete