I have a touchscreen page with an element <div id="x">
with several sub-elements in the form of:
<div id="x_1" style="certain_class" pid="1723464"></div>
<div id="x_2" style="certain_class" pid="1723465"></div>
<div id="x_3" style="certain_class" pid="1723466"></div>
<div id="x_4" style="certain_class" pid="1723467"></div>
These elements have a jQuery touchstart
bind event set on them... Now if I alter these sub-elements using:
$("#x").html("<div id="x_1"></div><div id="x_2"></div><div id="x_3"></div><div id="x_4"></div>");
which changes these sub-elements to:
<div id="x_1"></div>
<div id="x_2"></div>
<div id="x_3"></div>
<div id="x_4"></div>
Why is it I seem to lose the touchstart
bind set to these elements? Is it because I'm rendering the sub-elements within the parent element null and void, and thus the binding event?
Should I be changing the extra parameters on these elements bit by bit through the individual sub-elements within the parent node, rather than using the .html()
method on the parent node?
Any help is greatly appreciated...