gpt4 book ai didi

javascript - jQuery 关于单选按钮的更改事件

转载 作者:行者123 更新时间:2023-11-30 12:07:30 25 4
gpt4 key购买 nike

这是我的 html:

<div class="form-item">
<label>Disability: </label>
<div class="form-radios student_course_disablity">
<div class="form-item" id="edit-student-course-disability-not-stated-wrapper">
<label class="option" for="edit-student-course-disability-not-stated">
<input type="radio" id="edit-student-course-disability-not-stated" name="student[course][disability]" value="not_stated" checked="checked" class="form-radio student_course_disablity"> Not Stated</label>
</div>
<div class="form-item" id="edit-student-course-disability-yes-wrapper">
<label class="option" for="edit-student-course-disability-yes">
<input type="radio" id="edit-student-course-disability-yes" name="student[course][disability]" value="yes" class="form-radio student_course_disablity"> Yes</label>
</div>
<div class="form-item" id="edit-student-course-disability-no-wrapper">
<label class="option" for="edit-student-course-disability-no">
<input type="radio" id="edit-student-course-disability-no" name="student[course][disability]" value="no" class="form-radio student_course_disablity"> No</label>
</div>
</div>

我想为这个单选按钮运行 onchange 事件:

我试过这个方法:

$('input[type=radio][name=student[course][disability]]').change(function() {
alert('hi');
});

但没有运气

最佳答案

将名称放在双引号中,如下所示。希望这会有所帮助。

$('input[type=radio][name="student[course][disability]"]').change(function () {   
alert('hi');
});

关于javascript - jQuery 关于单选按钮的更改事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34764697/

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