• wrap添加及去除外层dom的方法


    Wrap an HTML structure around each element in the set of matched elements. .wrap()
    Wrap an HTML structure around all elements in the set of matched elements. .wrapAll()
    Wrap an HTML structure around the content of each element in the set of matched elements. .wrapInner()
    Remove the parents of the set of matched elements from the DOM, leaving the matched elements in their place. .unwrap()

                <div class="container">
                    <div class="inner">Hello</div>
                    <div class="inner">Goodbye</div>
                </div>
                $('.inner').wrap('<div class="new" />');
                <div class="container">
                    <div class="new">
                        <div class="inner">Hello</div>
                    </div>
                    <div class="new">
                        <div class="inner">Goodbye</div>
                    </div>
                </div>
    
                <div class="container">
                    <div class="inner">Hello</div>
                    <div class="inner">Goodbye</div>
                </div>
                $('.inner').wrapAll('<div class="new" />');
                <div class="container">
                    <div class="new">
                        <div class="inner">Hello</div>
                        <div class="inner">Goodbye</div>
                    </div>
                </div>
    
    
                <div class="container">
                    <div class="inner">Hello</div>
                    <div class="inner">Goodbye</div>
                </div>
                $('.inner').wrapInner('<div class="new" />');
                <div class="container">
                    <div class="inner">
                        <div class="new">Hello</div>
                    </div>
                    <div class="inner">
                        <div class="new">Goodbye</div>
                    </div>
                </div>
    

      

  • 相关阅读:
    $this是什么意思-成员变量和局部变量的调用
    神经网络 ML08 c-d-e
    机器学习笔记 ML01c
    虚函数
    C++有哪几种情况只能用初始化列表,而不能用赋值?
    C++ 的 I/O
    引用
    宏定义 #define 和常量 const 的区别
    怎么设置才能让外网ip可以访问mysql数据库[转]
    大师的框架面试总结[转]
  • 原文地址:https://www.cnblogs.com/longze/p/3029960.html
Copyright © 2020-2023  润新知