Tuesday, 15 July 2014

javascript - html body ondblclick get clicked element -



javascript - html body ondblclick get clicked element -

so in html have portion:

<body ondblclick="myfunc();"> <div id="id1">dasd</div> <div id="id2">dasda</div> </body>

and in javascript function :

function myfunc() { stuff here... }

i want know within myfunc() on element of html body doubleclick made, because don't want triger myfunc() on every doubleclicked element

so how can observe id of element doubleclicked?

<body ondblclick="myfunc(event);"> function myfunc(e) { // e.target -> element clicked }

javascript html

No comments:

Post a Comment