javascript - Specifying jQuery on() to a specific class or id -
i have templating code generates new hyperlinks , buttons have events tied them. possible use on() event binder distinguish different types of buttons based on class attributes, on catching buttons , hyperlinks?
the code working is:
$("#search-results-form").on("click", "button", function(e) { // on clear });
<!-- generated template --> <div id="search-results-form"> <button class="submit">submit</button> <button class="clear">clear</button> </div>
you can use selector, here example of class selector
$("#search-results-form").on("click", "button.clear", function(e) { // on clear });
Comments
Post a Comment