zoukankan      html  css  js  c++  java
  • jquery find 推荐

    https://codeplayer.vip/p/j7soa

    这篇写的还是不错的,备用。

    // 返回jQuery对象所有匹配元素的标识信息数组
    // 每个元素形如:tagName或tagName#id(如果有id的话)
    function getTagsInfo($doms){
    	return $doms.map(function(){
    		return this.tagName + (this.id ? "#" + this.id : "");
    	}).get();
    }
    
    // 匹配id为e1的元素
    var $e1 = $("#e1");
    var $e1_span = $e1.find("span");
    document.writeln( getTagsInfo( $e1_span ) ); // SPAN#e2,SPAN#e3,SPAN#e4,SPAN#e5
    
    var $p = $("p");
    var $p_span = $p.find("span");
    document.writeln( getTagsInfo( $p_span ) ); // SPAN#e2,SPAN#e3,SPAN#e4,SPAN#e5,SPAN#e7
    
    var $highlight = $p.find( $(".highlight") );
    document.writeln( getTagsInfo( $highlight ) ); // SPAN#e7
    
    var a = document.getElementsByTagName("a");
    var $a = $p.find( a );
    document.writeln( getTagsInfo( $a ) ); // A#e8
  • 相关阅读:
    ajax_注册
    mysql 二
    mysql基础
    django数据库批量创建
    私有属性
    mysql操作
    @property @classmethod @staticmethod
    python中的__new__方法
    员工信息表-装逼版
    三级菜单
  • 原文地址:https://www.cnblogs.com/dunkbird/p/11433603.html
Copyright © 2011-2022 走看看