I have the following code here when I click on the Your JsFiddle link works just to explain, the click event is on a tag I would like to get it
$ (document) .ready (function () {function doaction (e) {var eve, id ; Eve = $ (e.target); id = eve.attr ('id'); Alert (id);} $ ("Delete"). Click (function (e) {doaction (e);}); }); & Lt; Div class = "delete" id = "del / a" & gt; & Lt; A href = "javascript: zero (0);" Id = "delete / 1" & gt; A & lt; / A & gt; & Lt; / Div & gt; & Lt; Div class = "delete" id = "del / two" & gt; & Lt; A href = "javascript: zero (0);" Id = & gt; "/ 2 delete", two & lt; / A & gt; & Lt; / Div & gt; & Lt; Div class = "delete" id = "del / three" & gt; & Lt; A href = "javascript: zero (0);" Id = "delete / 3" & gt; Three & lt; / A & gt; & Lt; / Div & gt; For the demo,
div , not on
a . Therefore, if you click on
a , you will get that ID, but if you click inside
div , but
a No, you will get a
div id, not a code from
a since
a is inside
div , click on it Doing will trigger the event.
Comments
Post a Comment