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
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 the elements that was clicked is checked off
For all elements with a class of “field”, remove all child elements and append an input element.