Home > OS >  How can I make the form editable when I click the edit button?
How can I make the form editable when I click the edit button?

Time:04-04

I made a basic profile page and users can be edit their profile informations. I put a button to end of the page. At first, form should be unedited but when I click the button form became editable. I tried to use :disable in my tag bu didn't work. How can I solve this?

CodePudding user response:

Jquery solution:

Disable input field

$( "#your_form_input_id" ).prop( "disabled", true );

Enable input field

$( "#your_form_input_id" ).prop( "disabled", false );

CodePudding user response:

You should do it like this.

<input type="text" id="no_of_staff" readonly />

and after you click the button

$("#no_of_staff").attr("readonly", false);
  • Related