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/ –