$(document).ready(function () {
$("#Button_Edit").click(function () {
var radio1 = $("#GridView_Customer_Project_List:radio[id^='RadioButton_Select']");
if (radio1.is(':checked') == true) {
alert("Selected");
}
if (radio1.is(':checked') == false) {
alert("Not selected");
}
});
});
在上面的代码中始终没有选择警报消息,我想同时进行验证
答案 0 :(得分:1)
我认为你没有正确选择GridView。试试这个:
var count=$('table[id*="GridView_Customer_Project_List"] input[type="radio"]:checked').length;
if (count > 0){
alert ('Selected');
}
else
alert('Not Selected');
答案 1 :(得分:0)
尝试以下代码
$(document).ready(function () {
$("#Button_Edit").click(function () {
var radio1 = $("#GridView_Customer_Project_List:radio[id^='RadioButton_Select']");
if (radio1.is(':checked') == true) {
alert("Selected");
}
else
{
if (radio1.is(':checked') == false) {
alert("Not selected");
}
}
});
});