HTML:
<div id="wrapper">
<span class="stuff">Content</span>
<span class="stuff">Content</span>
</div>
JQuery:
$(document).delegate("#wrapper > *","click", function(){
//do stuff
}
Above is a short code break out of my structure.
Basically I am trying to provide an click event for the parent and all children.
This seems to work fine in Safari, Chrome, Firefox, and IE 7+. However it doesn't seem to on iOS devices (have not tested android).
Anyone have any idea how to get this to work, or a better approach?
Try this on your iOS device: http://jsfiddle.net/r3E6a/1/show
Code is here: http://jsfiddle.net/r3E6a/1/
Cheers.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.