1

I use jQuery 1.8.3.

Here is my html input text box:

<input type="text" name="textinput-hide" id="textinput1" placeholder="Text input" value="" disabled>

Here how I try to remove disable element:

  $('#textinput1').removeProp('disabled');

But the row above dosn't remove disabled attribute. How to remove disable element

Anant Kumar Singh
  • 68,309
  • 10
  • 50
  • 94
Michael
  • 12,788
  • 49
  • 133
  • 253

1 Answers1

1

If you want to remove disable attribute:-

$('input').each(function(){
  if($(this).prop("disabled")){
    $(this).prop("disabled", false);
  }
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<input type="text" name="textinput-hide" id="textinput1" placeholder="Text input1" value="" disabled><br><br>

<input type="text" name="textinput-hide" id="textinput2" placeholder="Text input2" value="">

If you want to remove complete element itself:-

$('input').each(function(){
  if($(this).prop("disabled")){
    $(this).remove();
  }
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

<input type="text" name="textinput-hide" id="textinput1" placeholder="Text input1" value="" disabled><br>

<input type="text" name="textinput-hide" id="textinput2" placeholder="Text input2" value="">
Anant Kumar Singh
  • 68,309
  • 10
  • 50
  • 94