누군가가 갤러리에서 여러 이미지를 선택할 수있는 앱을 개발 중입니다. onclick 함수를 호출하는 모든 이미지에 버튼을 추가했습니다. 버튼 onclick이 추가 된 이미지를 제거하려면 어떻게해야합니까?
<div id="images">
<img src="www.xyz.com/qwert.jpg" class="hi">
<input type="button" class="multiple">
<img src="www.xyz.com/qwerty.jpg" class="hi">
<input type="button" class="multiple">
<img src="www.xyz.com/qwertww.jpg" class="hi">
<input type="button" class="multiple">
</div>
이 코드를 사용할 수 있습니다.
$(".multiple").click(function () {
$(this).prev("img").remove();
});
단편
$(function () {
$(".multiple").click(function () {
$(this).prev("img").remove();
});
})
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<div id="images">
<img src="www.xyz.com/qwert.jpg" class="hi">
<input type="button" class="multiple">
<img src="www.xyz.com/qwerty.jpg" class="hi">
<input type="button" class="multiple">
<img src="www.xyz.com/qwertww.jpg" class="hi">
<input type="button" class="multiple">
</div>
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다