可能重复:
JQuery, is there a way to select all elements on the page with a specific attribute?
我的代码
<html>
<body>
<script>
$(function(){
$("No idea what to write here").remove();
});
</script>
<button data-fun="a">Remove</button>
<div data-fun="b">Remoave</div>
<span data-fun="c">Remdove</span>
<strong data-fun="d">Rdemove</strong>
<b data-fun="e">Remosve</b>
<p data-fun="f">Remoe</p>
<div>Not Remove</div>
</body>
</html>
我想删除所有具有data-fun
属性的元素,无论元素是什么,data-fun
的值是什么。
答案 0 :(得分:4)
答案 1 :(得分:0)