jquery给A标签注册click事件后无法触发 jQuery 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <a id="a" href="http://www.baidu.com">baidu</a> <br /> <button id="button">click</button> <script type="text/javascript"> document.getElementById("a").onclick = function() { alert("触发A标签click事件"); }; document.getElementById("button").onclick = function() { document.getElementById("a").onclick(); }; </script>通过以上代码可以看出a标签的click事件跟页面跳转没有关系要实现跳转必须鼠标去点 以上代码在IE8和火狐中是这样的,其他浏览器不清楚 $.("a").each(function(){ $(this).on("click",function(){ alert(123); }); }); 初步估计事件绑定出错$(document).ready(function(){ $("a").click(){ alert(this.id); }}试试 $(document).ready(function(){$("a").each(function(index,item){ $(this).bind("click",function(){ // 你的操作。}) })}) 在我的电脑上也是,我也是根据a标签的id 定义click 事件,但是事件无效,$("#aid").click(function(){}) //根据id名这样无效$(".class1").click(function(){}) //根据其引用的class 名可以不知道是为什么,但是可以找到解决方案 【求助】javascript如何获取area的属性?????? JS排序 如何开发一个类似百度图片滚动的功能? DIV切换与超链接的比较 准备学习prototype.js,帮助文档中有这么多列表,到底先学哪个啊?看进来看图! 帮忙啊,获取时间问题 这个函数这样使用另一个函数的变量? 关于树形目录 [js问题] for循环为什么不触发img onerror方法呢 如何获取使用apend的div element EXTJS 框架的精华部分是什么?求大神给答案 js页面样式 急需要
<a id="a" href="http://www.baidu.com">baidu</a>
<br />
<button id="button">click</button>
<script type="text/javascript">
document.getElementById("a").onclick = function() {
alert("触发A标签click事件");
};
document.getElementById("button").onclick = function() {
document.getElementById("a").onclick();
};
</script>通过以上代码可以看出a标签的click事件跟页面跳转没有关系
要实现跳转必须鼠标去点 以上代码在IE8和火狐中是这样的,其他浏览器不清楚
$.("a").each(function(){
$(this).on("click",function(){
alert(123);
});
});
$("a").click(){
alert(this.id);
}
}试试
$(document).ready(function(){
$("a").each(function(index,item){
$(this).bind("click",function(){
// 你的操作。
})
})
})
$("#aid").click(function(){}) //根据id名这样无效
$(".class1").click(function(){}) //根据其引用的class 名可以不知道是为什么,但是可以找到解决方案