i am making a website for mobile devices, in which i have a list of name and i need to bind click event to the list. i done this using jquery. in all webdevices (android, blackberry, nokia) when i click the list the result will come but nly in iphone the event is not triggering. how can i solve it.
<ol id="movie-list">
<li> Movie 1 </li>
<li> Movie 2 </li>
<li> Movie 3 </li>
</ol>
$('#movie-list li").live("click", function() {
console.log($(this).html());
});
http://bugs.jquery.com/ticket/5677 – Live Click Events Don’t Register On MobileSafari (iPhone)
Apparently that’s a jQuery bug. “The workaround is to add onclick=”” to the element you are attaching to….“
On a different note though,
.live()has been deprecated.The link provides information on porting to newer methods. If using jQuery 1.7+: