0
A
回答
0
根據@穆罕默德 - 優素福回覆,*
操作者將適合你用含有#
的條件:
$('a[href*="#"]').css('background-color', '#CCCCCC');
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<h4>Matched anchor will change background color:</h4>
<p><a href="#a">Anchor</a></p>
<p><a href="https://stackoverflow.com">URL</a></p>
<p><a href="https://stackoverflow.com#a">URL with anchor</a></p>
的jsfiddle實施例:https://jsfiddle.net/jennifergoncalves/jf66oc77/
相關問題
- 1. jquery:包含選擇器
- 2. JQuery選擇器:href屬性既不包含word1也不包含word2
- 3. jQuery的搜索與:包含選擇器
- 4. 包含NO LI的jQuery選擇器UL
- 5. 奇怪的包含(*)jQuery選擇器
- 6. 包含在選擇的jQuery
- 7. jQuery選擇的HREF
- 8. 沒有類的href的jQuery選擇器
- 9. jquery語法選擇器 - 包含
- 10. Jquery屬性不包含選擇器
- 11. 在jquery選擇器中包含+ startswith
- 12. 在jquery選擇器中包含變量
- 13. jquery查找包含子選擇器
- 14. 使用jQuery:包含選擇器
- 15. jQuery來選擇包含XYZ
- 16. jQuery選擇包含等號
- 17. jQuery選擇,包含等於
- 18. jQuery選擇的HREF鏈接
- 19. jquery href的選擇目標
- 20. jquery選擇href與* =
- 21. JQuery的 - 精梳選擇器包括:包含
- 22. jQuery的屬性包含選擇
- 23. 屬性選擇包含jQuery的
- 24. 的jQuery包含選擇不工作
- 25. JQuery的:選擇只包含 「 」
- 26. jQuery的,選擇,包含文本
- 27. jQuery的:選擇包含任何文本
- 28. jQuery的選擇包含ID點
- 29. jQuery屬性包含與包含斜線的文本的選擇器
- 30. jquery選擇<a>在嵌套div中包含特定href的標籤
'變種localNavLinks = $('a [href * =「#」]');''*'包含'^'以'$'開始, y建議閱讀[Selectors Here](https://code.tutsplus.com/tutorials/the-30-css-selectors-you-must-memorize-net-16048) –
這是我的前往CSS屬性選擇器參考https://css-tricks.com/attribute-selectors/ –