Javascript 与jquery 互转
jquery 为<script src="jquery-1.8.3.js"></script>
<script type="text/javascript"> $(function () { $("input").click(function () { var a= $("#shang ul li span"); var b = a.get(0); //jq 对象转 js 对象 b.innerHTML = "张三"; var c = $(b); //js 对象转 jq对象 c.css("background-color", "green"); }); }); </script> </head> <body> <input type="button" value="dianji"/> <div id="shang">dddds <ul> <li>fasl</li> <li> sssss<span> span hong</span></li> </ul> </div> </body>
时间: 2024-10-12 20:50:56