tanvi
tanvi

Reputation: 1

Enable disable textbox on checkbox click event in mvc4 razor view engine

this may sound silly but need to know how i could enable and disable textbox on checkbox click event in mvc. I am populating few items in a list and need to fill quantity in a textbox after corresponding checkbox is checked..

Upvotes: 0

Views: 1150

Answers (1)

Kerim Emurla
Kerim Emurla

Reputation: 1151

I would suggest using jQuery to pull this one off.

Your code would look something like this if you use jQuery:

$("#yourCheckBox").click(function () {
    $('#yourTextBox').attr("disabled", $(this).is(':checked'));
});

Upvotes: 1

Related Questions