views:

97

answers:

1

I am trying to learn jQuery and I posted a question asking for some help on a topic. Someone kindly helped me out and I highly appreciate it. I just want to know if someone can help me understand what the different parts of this is doing

$(".gradeA, .gradeU").find(":checkbox").click(function() {
    if (this.checked === false) { return; }
    var cells = $(this).parent().siblings();
    $(".fields").empty().append($("<input type='hidden'>").attr({
        id: "request_venue",
        name: "request[venue]",
        value: cells[1].innerHTML
    })).append($("<input type='hidden'>").attr({
        id: "request_showdate",
        name: "request[showdate]",
        value: cells[0].innerHTML
    }));    
});

what does the find do and the empty and just a quick walk through would be awesome so i can learn from it

+7  A: 
$(".gradeA, .gradeU").find(":checkbox")

For all elements that have a class of gradeA or gradeU, find all the checkboxes within the element and apply a click event to them.

if (this.checked === false) { return; }

If the elements that was clicked is checked off

$(".fields").empty().append($("<input type='hidden'>")

For all elements with a class of "field", remove all child elements and append an input element.

griegs
@Rup, thanks for the edits.
griegs