I'm having a hard time understanding the syntax of the .delegate function of jquery. Let's say I have the following:
$(".some_element_class").delegate("a", "click", function(){
alert($(this).html());
});
I know that the a
element is the element to which the click
event is applied. I know that once we click on that a
element, the event click
will be triggered and the callback function will be called. But what is the purpose of what comes before the .delegate
? In this case, what is the purpose of .some_element_class
? How do I read the above including the .some_element_class
? Also, in the example above, what does $(this)
represent? Does it represent the a
element or does it represent .some_element_class
?
Please somebody, shed some light on this.
Thank you