1

I'm using .val() to enter some data into a text box. However, when I go to click "add" I see that there is a disabled tag.

<input class="btn-primary action-submit" type="submit" value="Add" disabled="">

When I manually type in text, it disappears.

<input class="btn-primary action-submit" type="submit" value="Add">

Is there a way to remove it?

3
  • Is there a way to remove it? remove what? Commented Feb 9, 2016 at 18:08
  • "disabled" without having to type into the text box. When I add text in using .val() it still is there. Commented Feb 9, 2016 at 18:08
  • at what event do you want to remove it? Commented Feb 9, 2016 at 18:09

2 Answers 2

1

I'm not sure what exactly you want, but to remove attribute you could use Element.removeAttribute() method:

document.querySelector('.action-submit').removeAttribute('disabled');
//or
document.getElementsByClassName("action-submit")[0].removeAttribute('disabled');

Hope this helps.

Sign up to request clarification or add additional context in comments.

4 Comments

yes! that worked. I was trying to do it in jquery and it wasn't working.
I can't see Jquery tag in your question but you could try $('.action-submit').prop("disabled", false);.
yea, this didn't work for me :-(
Should work, you can make a fiddle?
0

To remove the disabled property with jQuery you would use this:

$('.action-submit').removeProp('disabled');

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.