解决方案 »
- 如何获取当前选中的option的class属性的值
- js从后台拿数据以表格显示
- js输出代码问题
- onload兼容性问题,求助...
- 新浪网站接入中连接按钮的回调地址问题。。
- jsp用insert插入数据,但不能录入数据库,请各位大侠帮忙
- js 显示等待信息或图片
- 如何在本地计算机上模拟某个链接的onMouseDown(即调用页面中的某个JavaScript写的函数)
- 请教梅花雪,MxTreeView1.0控件使用过程中有几个问题
- 请教document.write("<marquee>neirong</marquee>")定义的对象的定位问题
- 这是啥意思?
- 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里的值了