+ 3
Output problem!!!
https://code.sololearn.com/WcQpLRDZ2iwl/?ref=app I want the code to display the text in the chosen color.
3 Answers
+ 3
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<script>
function change(){
var
a = document.getElementById("field2"),
b = document.getElementById("c");
a.style.color = c.value;
}
</script>
<body><div align="center"><h1>Magical text generator</h1></div>
<fieldset><legend><h1>Input:</h1></legend>
<label>Write the text here:</label><input type="text" id="field1"><br>
<label>Choose your favourite color:</label>
<input type="color" onchange="change()" id="c"><br>Â <button onclick="document.getElementById('field2').value=document.getElementById('field1').value">Submit</button></fieldset><fieldset><legend><h1>Output:</h1></legend>
<textarea id="field2"></textarea></fieldset>
</body>
</html>
+ 2
Exactly, you must to take value of chosen color and put text with that color. You can use CSS and DOM
+ 1
I would suggest you to make the JavaScript Course. When you do it will be easier to solve the problem.