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

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

python - Django-cities exits with "killed" -

python - How to get a widget position inside it's layout in Kivy? -