Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

how to change the color using js

<!DOCTYPE html>
<html>
<head>
<script>
function display()
{
var col=document.getElementById("demo");
col.style.color="#FF0000";
}
</script>
</head>
<body>

<h1>My First JavaScript</h1>
<p id="demo">click on the button below.....</p>

<button onclick="display()">Display</button>

</body>
</html>
Comment

how to change color on js

document.getElementBiId("your id").style.color = "your color";
//it can also be used as:
document.body.style.backgroundColor = "your color";
Comment

javascript change color

var span = document.getElementsByTagName("span")[0];
span.style.color = "red";
Comment

PREVIOUS NEXT
Code Example
Javascript :: Angular Laravel has been blocked by CORS policy: Request header field x-requested-with is not allowed by Access-Control-Allow-Headers in preflight response. 
Javascript :: set span text jquery 
Javascript :: js clear all select options 
Javascript :: express req body undefined 
Javascript :: iterate through json object 
Javascript :: cancel axios request 
Javascript :: jquery upload image 
Javascript :: avoid no-param-reassign when setting a property 
Javascript :: cannot use import statement outside a module 
Javascript :: Obtain smallest value from array of objects in Javascript 
Javascript :: iterate through array js 
Javascript :: javascript play pause button 
Javascript :: to lowercase js 
Javascript :: js exit function 
Javascript :: axios react 
Javascript :: jquery check if input is empty 
Javascript :: jquery hover and hover out 
Javascript :: split string into int array javascript 
Javascript :: moment get start of week in datetime 
Javascript :: All Longest Strings javaScript 
Javascript :: js replace multiple 
Javascript :: is a letter javascript 
Javascript :: how to manage a db connection in javascript 
Javascript :: npm add latest version to package json 
Javascript :: nodejs event 
Javascript :: javascript open pdf in new tab 
Javascript :: javascript browser tab active 
Javascript :: javascript remove first character from array list 
Javascript :: js get html content 
Javascript :: wordpress javascript localization 
ADD CONTENT
Topic
Content
Source link
Name
7+7 =