解决方案 »
- document.getSelection()选中事件
- web开发 Safari浏览器下获取本机mac地址
- 上传文件同步提交,弹出对话框显示成功或者失败
- 这里可以换书吗,你知道吗?
- 紧急求助:如何用javascript 判断客户点击了ie右上角的关闭按钮
- 想实现一个足球比赛计时的显示,分钟数过60之后继续向上累加数量
- 做了个下拉菜单,因为页面间共用,放框架里了,框架高度和菜单差不多,这样一来下拉部分看不到,框架高度加大到下拉部全显示又很难看,
- 关于获取表格内信息问题!
- File exists check
- Extjs4.2如何实现表单,实现表单数据交互给表格展示等功能
- 这是啥意思?
- iscroll4 如何获取wrapper滚动区域内的某条内容值
//点击当前的a添加on类,并给其他a清除类名
$("#getcolor li a").click(function(){
$(this).addClass("on").parent().siblings().find("a").removeAttr("class");
})
</script>
$(this).children("a").addClass("class1").parent().siblings().find("a").removeClass("class1");
});
另外this.getElementsByTagName("a")[0].innerHTML这句,在jquery中可替换为$(this).find("a").eq(0).text()
$("ul li").bind("click",function() {
$(this).addClass("selected").siblings().removeClass("selected");
});
});
另外this.getElementsByTagName("a")[0].innerHTML这句,在jquery中可替换为$(this).find("a").eq(0).text()
这样写的话,是直接获取到了a标签吧。那又怎么获取到值呢
$("#getcolor li a").click(function(){
alert($(this).find("a").eq(0).text());
alert($(this).eq(0).text());
$(this).addClass("on").parent().siblings().find("a").removeAttr("class");
})
这两种alert都不行
$("#getcolor li a").click(function(){
alert($(this).find("a").eq(0).text());
alert($(this).eq(0).text());
$(this).addClass("on").parent().siblings().find("a").removeAttr("class");
})
另外this.getElementsByTagName("a")[0].innerHTML这句,在jquery中可替换为$(this).find("a").eq(0).text()不好意思,是我搞错了,谢谢二位。已经好了
$("#getcolor li a").click(function(){
alert($(this).find("a").eq(0).text());
alert($(this).eq(0).text());
$(this).addClass("on").parent().siblings().find("a").removeAttr("class");
})
直接$(this).text()就是a里的值了