实例代码:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<script src="./jquery-1.8.0.min.js"></script>
<div id="name">
<div filed="count" style="color:blue;height:200px;width:200px;background-color: yellow">
</div>
</div>
<script>
console.log($("div[filed='count']"));
// $("div[filed='count']").css("display","none");
</script>
</head>
<body>
</body>
</html>
本文介绍了一个HTML页面中如何使用jQuery的选择器来定位具有特定属性的元素,并演示了通过属性选择器隐藏一个带有特定属性的div元素。代码示例展示了如何在页面中引入jQuery库并使用控制台日志打印选中的元素。
1万+

被折叠的 条评论
为什么被折叠?



