Solution 1 :

How can I set to readonly=false property in order textbox to be enabled

There is no readonly="false" setting. If the readonly attribute exists on the element, with any value, then the field will be readonly.

If you want to make the element editable again you need to remove that attribute. Using jQuery the best practice would be to use prop():

$('#foo').prop('readonly', false);

However using removeAttr() will work too:

$('#foo').removeAttr('readonly');

Problem :

I have here a html code inside the javascript one and it will append that on my modal, my question is how can I set to readonly=false property in order textbox to be enabled. I’m trying jquery but it’s not working. The group of textboxes must be enabled when calling the class.

<script>
  var html;
 for ( x=0 ; x < 5 ; x++)
  {
    html +=' <input type="text" class="changeintofalse" readonly/>';
  }

  $('#details_info').html(html);
  $('#itemsModal').modal('show');
</script>

Comments

Comment posted by Rory McCrossan

Note that you have some syntax errors. The parentheses go around the variable declarations in the

Comment posted by codeSeven

i already tried, but i think jquery is not working, when my html code is inside of javascript. but thanks for the help.

Comment posted by Rory McCrossan

For this to work you need to either place the HTML you generated in to a jQuery object, or append it to the DOM first and then perform this action. Either way, it works.

Comment posted by Rory McCrossan

No problem, glad to help

By