Abd*_*yan 4 jquery onchange radio-button
HTML:
<div class="radio-list ">
<label class="radio-inline">
<span class=""><input type="radio" name="data[Customer][service_type]" id="service_type" value="new" checked=""></span> NEW INSTALLATION </label>
<label class="radio-inline">
<span class="checked"><input type="radio" name="data[Customer][service_type]" id="service_type" value="repair"></span> SERVICE REPAIR </label>
<label class="radio-inline">
<span class="checked"><input type="radio" name="data[Customer][service_type]" id="service_type" value="cancel"></span> CANCEL SERVICE </label>
<label class="radio-inline">
<span class="checked"><input type="radio" name="data[Customer][service_type]" id="service_type" value="other"></span> OTHER SERVICE </label>
</div>
Run Code Online (Sandbox Code Playgroud)
如何申请变更活动<input type="radio" name="data[Customer][service_type]" id="service_type" value="cancel">
?
$(function(){
$("input:radio[name='data[Customer][service_type]']").change(function(){
var _val = $(this).val();
console.log(_val);
});
});
Run Code Online (Sandbox Code Playgroud)
.change
是您需要触发的事件.