javascript - Windows store app - addEventListener on class -
i realize not possible add addeventlistener
on document.getelementbyclassname
selector. have several buttons identical functionality. can somehow? ok can use id selector, way i'll have add more code lines "needed".
with jquery:
$(".class").on("click", somefunction);
why not iterate through array returned document.getelementsbyclassname()?
var elements = document.getelementsbyclassname('foo'); (var = 0; < elements.length; i++) elements[i].addeventlistner('someevent', eventhandler(evt), false);
it might not succinct jquery equivalent gets job done. alternatively, use jquery in app(personally, haven't tried out).
Comments
Post a Comment