jq之$(“tr:even“).css(“background-color“,“yellow“)
生活随笔
收集整理的這篇文章主要介紹了
jq之$(“tr:even“).css(“background-color“,“yellow“)
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
<!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"><title>jq之demo</title><!--線上jq庫--><script src="https://code.jquery.com/jquery-3.4.1.min.js"></script><script>$(document).ready(function(){$("button").click(function(){/*$("tr:odd")偶數位置的tr元素,注意從0開始,所以標題也選上了*/$("tr:even").css("background-color","yellow");});});</script>
</head>
<body>
<h1>主頁</h1>
<table border="1"><tr><th>網站名</th><th>網址</th></tr><tr><td>百度</td><td>https://www.baidu.com/?tn=40020637_4_oem_dg</td></tr><tr><td>b站</td><td>https://www.bilibili.com/</td></tr><tr><td>csdn</td><td><a href="https://blog.csdn.net/wanggang182007">無名csdn</a></td></tr><tr><td>github</td><td>https://github.com/trending/java?since=monthly</td></tr><tr><td>gitee</td><td>https://search.gitee.com/?skin=rec&type=repository&q=%E7%94%B5%E5%95%86</td></tr>
</table>
<button>點我<button/>
</body>
</html>
總結
以上是生活随笔為你收集整理的jq之$(“tr:even“).css(“background-color“,“yellow“)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Python set list dict
- 下一篇: BugkuCTF-Crypto题简单加密