가능한 중복 :
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
입니다.
방법에 의한 화려한 질문 +1 : P 마음에 드는 비트는'$ ("여기에 쓸 내용이 없습니다")':) –
[jQuery 설명서] (http://api.jquery.com/), 특히 [선택자] (http://api.jquery.com/category/selectors/)와 관련하여 –