How to set colour picker in asp.net using JavaScript

Many times we want to change dynamic colour of the div / background. Using this article we can get this thing and we can choose our favorite colour by using colour picker   .



Source Code:-
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="colortoolkit.aspx.cs" Inherits="colortoolkit" %>

<!DOCTYPE html>
<html>
<head>
    <title>Color Picker Example</title>
    <style type="text/css">
        div
        {
            height: 100px;
            width: 100px;
        }
    </style>
    <script type="text/javascript">
        window.onload = function () {
            document.getElementById("colorpicker").onchange = function () {
                document.getElementById("showcolor").style.backgroundColor = document.getElementById("colorpicker").value;
            }
        }
    </script>
</head>
<body>
    Your favorite color:
    <input type="color" id="colorpicker" value="#‎6d53c1"><br />
    <div id="showcolor">
    </div>
</body>
</html>



Out-Put:
color picker

How to set colour picker in asp.net using JavaScript How to set colour picker in asp.net using JavaScript Reviewed by NEERAJ SRIVASTAVA on 1:35:00 PM Rating: 5

1 comment:

  1. Knowledge about the latest and vital technology would increase one's self esteem to the core at the time of lagging confidence. The content presented here is quite resembling the same. You have done a great job by sharing this in here.

    JAVA Training in Chennai | Mobile application testing training in Chennai | Hadoop training in chennai

    ReplyDelete

Powered by Blogger.