-2
divの中にテーブルがあります。親DIVのIDを取得
<div id="aaa">
<table>
<tr>
<td>
<button></button>
</td>
</tr>
</table>
</div>
「aaa」のdivのIDをボタンから取得するにはどうすればよいですか?私は最も近い親を使用しようとしましたが、それは私に「未定義」出力を与えます。
$(this).closest('div').attr('id');
それは私のために完璧に動作します。ボタンは「this」ですか? – Neil