img divがタップされたときに警告が追加されました。 1回のタップで複数のアラートが表示されます。 Webインターフェイスでは、時々私は単一の警告を得るが、モバイルでは複数回実行している。タップイベントは最初のタップでは機能していません。それは2番目のタップのために働いています。JQueryアラートポップアップが3回実行されましたが、1回実行されました
<html>
<body>
plug:<img id="plug" src="http://icons.iconarchive.com/icons/zeusbox/gartoon/32/socket-icon.png">
</body>
</html>
<script src="https://code.jquery.com/jquery-3.0.0.min.js"></script>
<script src="https://code.jquery.com/mobile/1.5.0-alpha.1/jquery.mobile-1.5.0-alpha.1.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.24/jquery-ui.min.js"></script>
<script>
$(document).ready(function(){
$("#plug").on('tap', function() {
alert("plese long press");
});
});
</script>
なぜあなたのスクリプトは 'html'タグの外ですか? – Laazo
それは問題ですか? – BhanuPrakash
これは不正な形式のドキュメントであるため、一部のブラウザではスクリプトが無視される場合があります。 – Laazo