HTML
<div id="result"></div>
<div id="result1"></div>
<div class="rrr">
<input type="radio" name="selector_" value="post_active" id="posts">Post
<br>
<input type="radio" name="selector_" value="page_active" id="pages">Page
</div>
<br />
<br />
<div class="rrr">
<input type="radio" name="selector_1" value="post_active1" id="posts1">Post
<br>
<input type="radio" name="selector_1" value="page_active1" id="pages1">Page
</div>
的Javascript
$("input:radio[name=selector_]").click(function() {
var value = $('input:radio[name=selector_]:checked').val();
$("#result").html(value + " is checked");
});
$("input:radio[name=selector_1]").click(function() {
var value = $('input:radio[name=selector_1]:checked').val();
$("#result1").html(value + " is checked");
});
是的,這是偉大的 - 它的工作!謝謝Tanya!但是,如果我創建dynamicaly無線電butonn組。例如 - 名稱=「選擇器_」,名稱=「selector_1」,名稱=「selector_2」等。這個JS腳本如何應用?我認爲必須爲所有羣體創造一種功能。但是它如何創造我不知道。請幫忙。 – Oleg 2015-03-31 10:26:53