• 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>
    

      

  • 相关阅读:
    翻转链表二
    最短路径算法
    在二叉树中插入节点
    LightOJ 1341
    串的基本操作
    链队列的基本操作
    LightOJ 1370
    poj 3060 Visible Lattice Points
    欧拉函数介绍及简单模板
    zoj 3593 One Person Game
  • 原文地址:https://www.cnblogs.com/babyzone2004/p/2195875.html
Copyright © 2020-2023  润新知