gpt4 book ai didi

javascript - 获取change事件中被点击的单选按钮Id

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

<分区>

我有几组同名的单选按钮。

我想获取更改事件中单击的单选按钮的 ID。有几个与此问题相关的答案,但它们都返回checked 的 id,但我想要的是clicked radio id。

已更新这是我的代码:

$('input[type=radio][name=SltOptionPane]').change(function () {
debugger;
//here i want to get the clicked id of the radio
var selectedValue = $("input[name=SltOptionPane]");
alert(selectedValue);
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="col-md-6 col-sm-4 col-xs-12" data-toggle="buttons" id="26Panel">
<div class="col-md-6">
<label class="btn btn-chackbox checkbox-lable-styles active" style="margin-bottom: 5px;">
<span class="glyphicon glyphicon-ok glyphicon-white"></span><input type="radio" name="SltOptionPane" value="27" id="27" autocomplete="off"><text>&nbsp;&nbsp;&nbsp;طبيعي</text>
</label>
</div>
<div class="col-md-6">
<label class="btn btn-chackbox checkbox-lable-styles" style="margin-bottom: 5px;">
<span class="glyphicon glyphicon-ok glyphicon-white"></span><input type="radio" name="SltOptionPane" value="29" id="29" autocomplete="off"><text>&nbsp;&nbsp;&nbsp;ضعيف</text>
</label>
</div>
</div>

<div class="col-md-6 col-sm-4 col-xs-12" data-toggle="buttons" id="27Panel">
<div class="col-md-6">
<label class="btn btn-chackbox checkbox-lable-styles active" style="margin-bottom: 5px;">
<span class="glyphicon glyphicon-ok glyphicon-white"></span><input type="radio" name="SltOptionPane" value="30" id="30" autocomplete="off"><text>&nbsp;&nbsp;&nbsp;طبيعي</text>
</label>
</div>
<div class="col-md-6">
<label class="btn btn-chackbox checkbox-lable-styles" style="margin-bottom: 5px;">
<span class="glyphicon glyphicon-ok glyphicon-white"></span><input type="radio" name="SltOptionPane" value="31" id="31" autocomplete="off"><text>&nbsp;&nbsp;&nbsp;ضعيف</text>
</label>
</div>
</div>

请帮忙,提前致谢

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