Closed Jonnas123 closed 10 months ago
Use the change
event.
pickerOne.on('change', (ev) => {
document.getElementById('button').disabled = false;
})
This is ok if I have one picker. But I have two pickers. How about to enable the button if the two conditions are met?
Try this
let colorOne = '';
let colorTwo = '';
const button = document.getElementById('button');
function enableButton() {
if (colorOne && colorTwo) {
button.disabled = false;
}
}
pickerOne.on('change', (color) => {
colorOne = color.rgb;
enableButton();
});
pickerTwo.on('change', (color) => {
colorTwo = color.rgb;
enableButton();
});
Wow, It works, thanks.
How to check if the colors are picked? I disable a button by default
<button disabled>Submit</button>
And I have two pickers. I want to enable the button if all the two colors from the two pickers are picked.