ラジオグループの変更を監視しようとしています。
次の HTML でトップコートを使用しています。
<ul class="topcoat-list">
<li class="topcoat-list__item">
<label class="topcoat-radio-button__label">
<input type="radio" name="topcoat" value="1" checked="checked">
<div class="topcoat-radio-button"></div>
Test1
</label>
</li>
<li class="topcoat-list__item">
<label class="topcoat-radio-button__label">
<input type="radio" name="topcoat" value="2">
<div class="topcoat-radio-button"></div>
Test2
</label>
</li>
<li class="topcoat-list__item">
<label class="topcoat-radio-button__label">
<input type="radio" name="topcoat" value="3">
<div class="topcoat-radio-button"></div>
Test3
</label>
</li>
</ul>
よくわからない理由でchecked
、使用者が別のラジオボタンを選択したときに属性が更新されません...
javascriptで変化を監視できるようにしたいのですが、今のところラジオグループの値が取得できません...
$('input[name=topcoat]').change(function(){ changed() });
function changed() {
id = $('input[name=topcoat]').val();
alert(id);
}