I have this function for the delete button (to delete based on what I click) and this work But when I clicked the other button functions to delete it, which is not going to do this. How can I affect other buttons?
function myDelete () {$ (document) .on ('click', '.item', function () {$ (this) .remove (); var sum = 0;} ); }
You will force your 'click' event to be a special dom object, rather Compared to document object.
Please try this code:
function myDelete () {$ ('. Item'). ('Click', function () {$ (this) .remove (); var sum = 0;}); }
Besides, it seems strange to me that you have to wrap it in the function. A general cover ("at the domes") should be sufficient in most cases:
$ (function () {// code here like: $ ('item'). On ('click', function () {$ (this) .remove (); var sum = 0;})}});
No comments:
Post a Comment