jquery get radiobuttonlist by id dynamically
- by Cindy
I have two radiobuttonlist and one checkboxlist on the page. Ideally based on the checkbox selected value, I want to enable/disable corresponding radibuttonlist with jquery function.
But some how $("input[name*=" + columnName + "]") always return null. It can not find the radiobuttonlist by its name?
$(function() {
function checkBoxClicked() {
var isChecked = $(this).is(":checked");
var columnName = "rblColumn" + $(this).parent().attr("alt");
if (isChecked) {
$("input[name*=" + columnName + "]").removeAttr("disabled");
} else {
$("input[name*=" + columnName + "]").attr("disabled", "disabled");
$("input[name*=" + columnName + "] input").each(function() {
$(this).attr("checked", "")
});
}
}
//intercept any check box click event inside the #list Div
$(":checkbox").click(checkBoxClicked);
});