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

Alive to die - Anant
  • 70,531
  • 10
  • 51
  • 98
Michael
  • 13,950
  • 57
  • 145
  • 288

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="">
Alive to die - Anant
  • 70,531
  • 10
  • 51
  • 98