Closed Turtleted21 closed 1 year ago
Hi How to programmatically change the thumbnail color (without a click/pick event)?
I try this without success :
Coloris({ el: ".coloris", input: "#ff0000", wrap: true, // swatchesOnly: true, alpha: false, swatches: ["#264653", "#2a9d8f", "#e9c46a", "#f4a261", "#e76f51", "#48cae4"], });
default with a empty value : <input id="color-changer" type="text" class="coloris" value="" style="width: 25px; height: 25px; border-radius: 5px; box-sizing: border-box" />
<input id="color-changer" type="text" class="coloris" value="" style="width: 25px; height: 25px; border-radius: 5px; box-sizing: border-box" />
try to change to pink : document.getElementById("color-changer").dispatchEvent(new Event("input", { value: "#ff00ff" }));
document.getElementById("color-changer").dispatchEvent(new Event("input", { value: "#ff00ff" }));
or
document.getElementById("color-changer").value = "#ff00ff";
Thanks
Hi How to programmatically change the thumbnail color (without a click/pick event)?
I try this without success :
default with a empty value :
<input id="color-changer" type="text" class="coloris" value="" style="width: 25px; height: 25px; border-radius: 5px; box-sizing: border-box" />
try to change to pink :
document.getElementById("color-changer").dispatchEvent(new Event("input", { value: "#ff00ff" }));
or
document.getElementById("color-changer").value = "#ff00ff";
Thanks