Input type color property type in Javascript
The input type color property type used to set and retrieve the type, It always returns the color but it can be reset by using property type. It returns a string that represents the type of input element.
Syntax
 1 <input>.type // to retrieve
 2 <input>.type = <string> // to set
input : A input type color element object to set and retrieve type property
string : It specifies the type of the input element
Note : If value set using type property for the input element, it must be valid type name supported by an HTML
Input color property type
 1 <!DOCTYPE html>
 2 <html>
 3 <style>
 4   .container {
 5     margin: 20px 0;
 6   }
 7 </style>
 8 <body>
 9 	<h1>The Input Color Object</h1>
 10 	<h2>Example</h2>
 11 	
 12 	<div class="container">
 13 	  <form>
 14 	    <input name="colors" id="color" type="color">
 15 	  </form>
 16 	</div>
 17 
 18 	<button onclick="access()">Access</button>
 19 	<p id="result"></p>
 20 	<script>
 21 	function access() {	  
 22 	  const element = document.getElementById("color");
 23 	  const str = `An input color property type is <b>${element.type}</b>`;
 24 	  document.getElementById("result").innerHTML = str;
 25 
 26 	  element.type = "text";
 27 	}
 28 	</script>
 29 </body>
 30 </html>
Input color property type
Privacy Policy
Terms of Service
Disclaimer
Contact us
About us