gpt4 book ai didi

jquery - 如何使用jquery应用单选按钮上的更改事件

转载 作者:行者123 更新时间:2023-11-30 23:56:59 24 4
gpt4 key购买 nike

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>

如何申请<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);
});

});

.change 是您需要触发的事件。

See it here.

关于jquery - 如何使用jquery应用单选按钮上的更改事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33705629/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com