Table of Contents

How to choose background color through a color picker?

In this article, I will show to change background color through a color picker. I think this will help you

HTML & JS Code

<label for="clr"> Background Color </label>
<input type="color" id="clr" class="form-control mt-2">

<div id="background" style="height:50px; width:100px"></div>


         const bgclr = document.getElementById("clr"); // color selector
         const headingg = document.getElementById("background");

         bgclr.addEventListener("input", () => {
      = bgclr.value;
      = bgclr.value;


Share on facebook
Share on twitter
Share on linkedin

Leave a Comment

Your email address will not be published.

Related Posts