I am developing MVC application. I have check box and submit button.
I want to enable submit button on check box's checked event and on unchecked submit button should disable.
How to do this ?
I have below code....
@model PaymentAdviceEntity.Account
@using PaymentAdviceEntity;
@{
ViewBag.Title = "Create";
PaymentAdvice oPA = new PaymentAdvice();
oPA = (PaymentAdvice)ViewBag.PaymentAdviceObject;
<div>
<input type="checkbox" class="optionChk" value="1" /> Paid
</div>
<input type="submit" value="Create" />
<input type="button" class="btn-primary" />
}
<script type="text/javascript">
$(".optionChk").on("change", function () {
if ($(this).is(":checked"))
{
alert("1");
$(".SubmitButton").attr("disabled", "disabled");
} else
{
alert("2");
$(".SubmitButton").attr("enable", "enable");
}
});
</script>