jquery实践1
1,今天发现jquery获取的dom对象除了jquery对象外,还可以访问原来的对象,只要加一个[]就行了,原来还有这样的功能,之前没仔细研究。
2,用了first-child,nth-child(n),获取元素集合里面的第几个元素。
3,用Jquery访问nodeText节点,通过访问原来的对象,nextSibling访问。访问是nextSibling.nodeValue;
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>Zephyr's Document</title>
<script src="http://common.cnblogs.com/script/jquery.js"></script>
<style type="text/css" media="screen">
/*<![CDATA[*/
/*]]>*/
</style>
<script type="text/javascript">
$(function(){
var tempBr=$("br");
tempBr.each(function(index,doElem){
doElem.nextSibling.nodeValue=doElem.nextSibling.nodeValue.replace(/\s{6}/g,"");
})})
</script>
</head>
<body>
asdf
<br />
" asdf"
<br />
" asdf"
<br />
" asdf"
</body>
</html>
浙公网安备 33010602011771号