Answer the question
In order to leave comments, you need to log in
How to remove the disabled attribute from a button?
Good day, tell me how to remove the disabled attribute in this case?
<button c-userssnpincheck_userssnpincheck="" title="Continue" disabled="" class="slds-button slds-button_stretch slds-col slds-button_brand">Continue</button>
document.getElementsByTagName('button')[0].removeAttribute('disabled');
document.getElementsByTagName("slds-button slds-button_stretch slds-col slds-button_brand").removeAttribute('disabled');
document.getElementsByClassName("slds-button slds-button_stretch slds-col slds-button_brand").removeAttribute('disabled');
document.getElementsByClassName("slds-button slds-button_stretch slds-col slds-button_brand").disabled = false;
Answer the question
In order to leave comments, you need to log in
You are looking for multiple elements and not 1
Doesn't work because you can't apply ".disabled" to an array
document.querySelector('button').disabled = false
In general, the answer has been given to you, I will add that if you do not want to iterate over the array, then you can use jquery:
$("button .slds-button") .prop( "disabled", false );
Firstly - you initially gave incorrect data in the question, and despite the presence of the correct answer to it, you could not adapt it to the full code ...
Secondly - there is always the opportunity to check what is happening in your code, for example, what your selector will select, the magic of console .log() in action.
And thirdly - reading the documentation, which you are neglecting - document.querySelector() selects one first matching element, which in your example will be a completely different button.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question