• jquery和document之间相互转换


    <script src="jquery-2/jquery.js"></script>
    <script type="text/javascript">
        $(document).ready(function(){
            //也可以用$(function(){})

    //得到jquery对象
            var $te1=$("#t4");

    //显示出来
        alert($te1.html());
        var t2=document.getElementById("t2");


        alert(t2.innerHTML);

    //转doucment
        var te11=$te1.get(0);
        alert(te11.innerHTML);

    //转jquery
        var $tt2=$(t2);
        alert($tt2.html());
            });

    </script>
    <body>
    <div id="tt">
    <h1 id="t1" name="t1">1</h1>
    <h1 id="t2">22</h1>
    <h1 id="t3">333</h1>
    <h1 id="t4" name="nn">4444</h1>
    </div>

    </body>

  • 相关阅读:
    机器学习——模型评估与选择
    论文等级
    python简介
    记忆力
    PyQt 5控件
    PyQt5对话框
    PyQt 5事件和信号
    PyQt 5菜单和工具栏
    PyQt 5布局管理
    PyQt 5的基本功能
  • 原文地址:https://www.cnblogs.com/tiandjnet/p/3035021.html
Copyright © 2020-2023  润新知