javascript - Hiding element after firing click handler -
Say that to add a clickable image after a set of elements, I have the following code when clicked So every time the click is done the image which is clicked, which I do not want. I think hiding the image using .hide () in click handler is an approach, but I can not understand how the IMG element is referred to in the click handler.
Help? Thanks
$ (...). After ($ ('& lt; img src = "..." />') .css ("cursor", "indicator"). Etter ("title", "click here ..."). Click (function () {...}
Give the image a unique ID:
$ (...) .after ($ ('& lt; img id = "Myimage" src = "..." /> ; ') .css ("cursor", "pointer") .attr ("title", "click here ..."). (Function () {var img = $ (' # myimage ');}
Comments
Post a Comment