Disable readonly to text box onclicking the button

后端 未结 3 508
醉话见心
醉话见心 2021-01-04 06:07

I have used "readonly" attribute to the textbox which makes the textbox non editable and may i know how to disable the readonly attribute on clicking the button. c

3条回答
  •  滥情空心
    2021-01-04 06:46

    Well, to be simple! You can use jQuery to remove this attribute (jQuery would be simple, you can do this using JS too). Here is the code for that:

    $('input[type=submit]').click(function () {
      $('input[type=text]').removeAttr('readonly');
    })
    

    https://api.jquery.com/removeAttr/

提交回复
热议问题