所选择的无线电按钮值I有一个PHP循环内的下列单选按钮:获取ALT =“”从与jQuery
<form>
<table class="table table-bordered optionsChk">
<tr>
<td colspan="2"> Select Bench for case </td>
</tr>
<?php foreach($db->getRecordSet($sql) as $bench){ ;?>
<tr>
<td class="w5">
<input type="radio" alt="<?php echo($bench['lbl']); ?>" value="<?php echo($bench['sno']); ?>" name="b_sno" id="b_<?php echo($bench['sno']); ?>">
</td>
<td class="w95"> <label for="b_<?php echo($bench['sno']); ?>"><?php echo($bench['lbl']); ?></label> </td>
</tr>
<?php
}
?>
我显示上述的值用下面的函数:
function doneBenchSelection() {
try {
var benchSno = $("input[type=radio][name=b_sno]:checked").val();
$("#benchSno").val(benchSno);
$("#obj_lst").html("Selected Bench Label: "+$("input[type=radio][name=b_sno]:checked").text());
} catch(e) {
alert(e.message);
}
}
我想从所选择的单选按钮alt="some text"
文本:
$("#obj_lst").html("Selected Bench Label: "+$("input[type=radio][name=b_sno]:checked").text());
是我正确的方式?或者这不是推荐的方式?请帮忙。
邑它working-非常好感谢madalin ivascu –
请告诉我背后暗示循环逻辑?当只有一个电台可以在一个点检查 – Satpal
@Satpal oops不知道他有同名的电台buton :) – madalinivascu