我的代码有一些问题
<input type="text" id="search-qq">
<script>
$('#search-qq').keypress(function(event) {alert('key pressed');});
</script>
这段代码在我的电脑上运行,
但为什么这个代码不能在我的android(默认浏览器,
安卓2.3.6)?
最佳答案
也许原因是alert
是针对javascript的,而在Android中它可能使用AlertDialog
而不是alert
?并不是任何可以在网页上运行的代码也可以在移动设备上运行,如果你想编写移动网站代码,你应该使用 jQuery mobile 来代替,看这个:JQuery Mobile
关于手机上的 JavaScript keydown,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9222193/