ssssssss &"/> ssssssss &">
Home > Article > Web Front-end > zepto and jQuery on event delegation on iPhone
The page made with zepto on the mobile terminal suddenly found that the click event bound to on was not triggered. The code is as follows:
<ul> <li class="a">1111111aaaaaaasssss</li> <li class="b">aaaaaaassssss</li> <li class="c">ssssssss</li> </ul> <script> $(document).on('click','.c',function(argument) { alert($(this).html()) }) </script>
I changed this writing method to a non-event delegation method, and found that the click event was It can trigger
$(‘.a’).on('click',function(argument) { alert($(this).html()) });
Finally, try replacing $(document) with $('body') or $('ul'). The experimental result is:
$(document) No
$('body') No
$('ul') OK
The above is the detailed content of zepto and jQuery on event delegation on iPhone. For more information, please follow other related articles on the PHP Chinese website!