私の HTML コードには div があります。この div には、ユーザーへの警告が含まれています。警告は、ID のない div 要素内にラップされます。ユーザーが閉じるボタンをクリックすると、警告 div が削除されます。
<div id="alarmbox" align="center">
<div>this is warning 1<button onclick="remove_div_of_this_button(this);">x</button></div>
<div>this is warning 2<button onclick="remove_div_of_this_button(this);">x</button></div>
</div>
これは私のJSコードです:
function remove_div_of_this_button(thisbutton)
{
thisbutton.parentNode.parentNode.removeChild(thisbutton.parentNode);
}
それは正常に動作します。ただし、要素の削除は、突然削除するよりもアニメーション化する方が適切です。JS だけを操作したい場合、jquery で div を削除するにはどうすればよいですか? thisbutton
$(thisbutton) はここでは機能しないため、jquery で識別できますか?