[英]javascript click event isn't working on link inside contenteditable div in iOS
HTML: HTML:
<div id="content" contenteditable="true">
Some text <a href="/">Link</a>
</div>
Javascript: Javascript:
$("#content").find('a').click(function(){
alert('a clicked');
});
Problem: alert isn't called. 问题:没有调用警报。 It seems that click event isn't called
似乎没有调用click事件
jsfiddle: http://jsfiddle.net/bFtbV/ jsfiddle: http : //jsfiddle.net/bFtbV/
Not enough info here, unless you didn't override the default behavior of the link. 这里没有足够的信息,除非您没有覆盖链接的默认行为。 If that is the case with this code it should work:
如果是这种代码,它应该可以工作:
$("#content").find('a').click(function(e){
e.preventDefault();
alert('a clicked');
return false;
});
If not: 如果不:
Have you tested it on a pc or mac? 您在PC或Mac上测试过吗? iOS isn't the best place to debug!
iOS不是最佳的调试场所! With iOS6 it's even harder unless you have mac with Lion OS X.
借助iOS6,除非您将Mac与Lion OS X结合使用,否则甚至更难。
Test and give us feedback 测试并给我们反馈
Try selecting the a tag directly in the selector: 尝试直接在选择器中选择一个标签:
$("#content a").click(function(){
alert('a clicked');
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.