0
以下は私のhtml Dom.私は選択オプションのデータ属性をフェッチしたいです。私の次のjQueryが動作していないdata-brand-id
フェッチするためにjqueryで選択されたオプションのデータ属性を取得できません
<table class="fanpage-table">
<tbody>
<tr>
<td>Blog System...</td>
<td>History......</td>
<td>
<select name="brand_dropdown">
<option data-brand-id="xxxthisxxxxxxx">PKB</option>
<option data-brand-id="xxxthisxxxxxxx">QKJ</option>
</select>
</td>
<td><i class="fa fa-check-square-o save-fan-page" data-fanpage-id="xxxxxxxxxx"></i></td>
</tr>
</tbody>
</table>
。
$(".save-fan-page").on("click",function()
{
$(this).closest("tr").find("select[name='brand_dropdown']option:selected").data("brand-id");
}