0

If I use the below code, will it disable the textbox even if I am inserting a new record?

<input id="code" data-bind="value: Code" name="Code" type="text" placeholder="Your Code" class="form-control input-md" readonly>
Web_Designer
  • 72,308
  • 93
  • 206
  • 262

3 Answers3

0

You can do it in jQuery using .prop() method.

$('input').prop('readonly', true) to disable the textbox or $('input').prop('readonly', false) to re-enable the textbox

prtdomingo
  • 971
  • 4
  • 14
0

You can use JQuery to change attribute of a control

$("#code").attr("readonly", false); 
Ritz
  • 394
  • 1
  • 3
  • 12
0

jQuery <1.9

$('#inputId').attr('readonly', true);

jQuery 1.9+

$('#inputId').prop('readonly', true);

Add "readonly" to <input > (jQuery)

Community
  • 1
  • 1
Hamed Javaheri
  • 538
  • 3
  • 13