framework7

Open full view…

Javascript on dynamically created elements

cweebs
Mon, 22 Sep 2014 14:25:10 GMT

Hi, I am trying create a function using a wildcard on an ID. It works great on my first static element with the id 'stockNo1' but any dynamically created elements are not using this function. I suspect that the javascript is loading on init and not looking for any more elements other than the first static element. Is there a way to do this? My code is basically: --- $$("[id^=stockNo]").on('change', function (event) { arr = event.target.id.slice(7); //find the number in the ID // do stuff here })

cweebs
Mon, 22 Sep 2014 14:33:41 GMT

Disregard, figured it out. Thanks!