我正在使用Uikit无线电输入(https://altair-html.tzdthemes.com/forms_regular.html)。
问题是无线电输入在代码和现场显示之间转换在用Ajax加载我的表单后,我想在每次更改后提醒无线电选择值。
下面是我的代码:HTML:<div class="uk-width-medium-1-2">
<h5>Radio set 1</h5>
<div class="uk-grid" data-uk-grid-margin>
<span class="icheck-inline">
<input type="radio" name="radio_opt" id="radio_opt_1" value="Yes" data-md-icheck />
<label for="radio_opt_1" class="inline-label">Oui</label>
</span>
<span class="icheck-inline">
<input type="radio" name="radio_opt" id="radio_opt_2" value="Non" data-md-icheck />
<label for="radio_opt_2" class="inline-label">No</label>
</span>
</div>
</div>
<div class="uk-width-medium-1-2">
<h5>Radio set 2</h5>
<div class="uk-grid" data-uk-grid-margin>
<span class="icheck-inline">
<input type="radio" name="radio_opt_second" id="radio_opt_3" value="Yes" data-md-icheck />
<label for="radio_opt_3" class="inline-label">Oui</label>
</span>
<span class="icheck-inline">
<input type="radio" name="radio_opt_second" id="radio_opt_4" value="Non" data-md-icheck />
<label for="radio_opt_4" class="inline-label">No</label>
</span>
</div>
</div>
然后这里我的JS(不工作)
$(document).on('change', 'input:radio', function () {
alert('test');
});
该主题正在使用iCheck,根据文档,您应该使用:
$('input:radio').on('ifChecked', function(event) {
alert('test');
});