html - Detecting Touch in a Div Box ? Javascript -
say have setup basic div :
<div id='signaturebox'></div>
i want register whenever box clicked on / touched in area. trying without success :
//register signature callback var signature = document.getelementbyid("signaturebox"); signature.onclick() = function () { alert('signature javascript triggered'); }
can ?
thanks !
you've put in parentheses unneeded onclick in javascript. correct working code here
var signature = document.getelementbyid("signaturebox"); signature.onclick = function () { alert('signature javascript triggered'); }
working fiddle here http://jsfiddle.net/7m9ek/1/
difference between html , javascript onclick
found here: http://www.w3schools.com/jsref/event_onclick.asp
Comments
Post a Comment