<input type='radio' name='rbTemplateList' id='template1" value=1 >
<input type='radio' name='rbTemplateList' id='template3" value=3 >
<input type='radio' name='rbTemplateList' id='template5" value=5 >
<input type='radio' name='rbTemplateList' id='template7" value=7 >我想单击其中的一个rbTemplateList,将引发ajax调用(jquery风格),但它根本不起作用…
我相信这与id和name属性有关
$(document).ready(function() {
var f = document.frm;
$("#rbTemplateList").click(function() {
pkTemplate= getSelectedRadioValue(f.rbTemplateList);
$.ajax({
url: "ajaxColor.php",
type: "POST",
data: 'pkTemplate='+pkTemplate,
timeout: 5000,
beforeSend: function(){ },
error: function(XMLHttpRequest, textStatus, errorThrown) {
},
success: function(output) {
},
complete: function(){ }
});
})
}); 发布于 2010-01-06 20:25:17
问题是您正在使用$("#rbTemplateList")将事件附加到单选按钮,但是开头的#引用元素的in,而rbTemplateList在html中是作为一个名称给出的。
您应该将选择器更改为$(":input[name='rbTemplateList']")
https://stackoverflow.com/questions/2010485
复制相似问题