HTML:
@Html.RadioButton("rdoGp_PriTenant", "rdoGp_PriTenantYes", true)<label>Yes</label>
@Html.RadioButton("rdoGp_PriTenant", "rdoGp_PriTenantNo", false)<label>No</label>
Let's say you have two radio buttons with same id and you want to disable them.
when you use
$("#rdoGp_PriTenant")
it selects only the first element with the given ID.
However, when you select by attribute (e.g. id in your case), it returns all matching elements, like so:
it selects only the first element with the given ID.
However, when you select by attribute (e.g. id in your case), it returns all matching elements, like so:
$("[id=rdoGp_PriTenant]").attr('disabled', 'disabled');
Working code using Jquery would be:
Working code using Jquery would be:
Jquery:
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
<script>
$(document).ready(function () {
$("[id=rdoGp_PriTenant]").attr('disabled', 'disabled');
});
</script>
No comments:
Write comments