ssssssss &"/> ssssssss &">

Home  >  Article  >  Web Front-end  >  zepto and jQuery on event delegation on iPhone

zepto and jQuery on event delegation on iPhone

一个新手
一个新手Original
2017-10-19 09:19:251879browse

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:

      
  • 1111111aaaaaaasssss
  •   
  • aaaaaaassssss
  •   
  • ssssssss

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn