Reputation: 1
I'm trying to change the background color of a button once the page is loaded. I'm able to disable the buttons, but the background color doesn't change. I have created this form using JotForm. Here is my code:
function Lock(){
document.getElementById("input_11").disabled = "true"
document.getElementById("input_11").bgcolor="grey";
}
Button I'm trying to change:
<div id="cid_11" class="form-input-wide" data-layout="full">
<div data-align="center" class="form-buttons-wrapper form-buttons-center jsTest-button-wrapperField">
<button id="input_11" type="submit" class="form-submit-button submit-button jf-form-buttons jsTest-submitField" data-component="button" data-content="">
Edit
</button>
</div>
</div>
Upvotes: -1
Views: 677
Reputation: 252
Bgcolor is one of those attributes that has become deprecated with the implementation of Cascading Style Sheets (see CSS Backgrounds). enter link description here
function Lock(){
document.getElementById("input_11").disabled = true
document.getElementById("input_11").style.backgroundColor = "grey";
}
Upvotes: 2
Reputation: 369
It needs to be a boolean
document.getElementById("input_11").disabled = true
That's is the error that happened to you
Upvotes: 0