- JScript code
<div> Resig</div> <div>George Martin</div> <div>Malcom John Sinclair</div> <div>J. Ohn</div> <script> $("div:contains('John')").css("color", "red"); </script>
为什么不好用呢!!
------解决方案--------------------
好用呀!!怎么会不好用呢??
结果是
下面的为 红色,其它颜色不变
Malcom John Sinclair
------解决方案--------------------
同楼上。
有没有正确导入jquery库?
------解决方案--------------------
- JScript code
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script> <div> Resig</div> <div>George Martin</div> <div>Malcom John Sinclair</div> <div>J. Ohn</div> <script> $("div:contains('John')").css("color", "red"); </script>
------解决方案--------------------
- HTML code
<div> <div> Resig</div> <div>George Martin</div> <div>Malcom John Sinclair</div> <div>J. Ohn</div> </div>