function resetName() {
var inputField = document.querySelector("#name");
inputField.value = "";
}
function setToGreen() {
var colorChooser = document.querySelector("#color");
colorChooser.value = "#00FF00";
}
function changeStep() {
var number = document.querySelector("#number");
number.value = 10;
number.step = "0.1";
number.max = 11;
}
function changeAndResize(img) {
img.src="https://pbs.twimg.com/profile_images/110455194/n666194627_2302_400x400.jpg";
img.width=250;
img.style.border = "4px solid red";
}
JS.DOM.ContentHtml.textContent.innerHTML.ChangingAttr
-----------------------------------------------------
A [Pen](https://codepen.io/Onlyforbopi/pen/KxLKQR) by [Pan Doul](https://codepen.io/Onlyforbopi) on [CodePen](https://codepen.io).
[License](https://codepen.io/Onlyforbopi/pen/KxLKQR/license).
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Modifying content of selected DOM nodes</title>
</head>
<body>
<h1>Try these</h1>
<p>What is your name: <input type="text" id="name" value="Michel"> <button onclick="resetName();">Reset (click to empty the input field)</button></p>
<p>Pick a color: <input id="color" type="color" value='#FF0000'><button onclick="setToGreen();">Set color chooser to green</button></p>
<p>In the next example, click on the input field and use the small vertical arrows to increase the value. Notice that the numbers go 1 by 1 and that the maximum value is 20. Then click the button and do the same thing!</p>
<p>Pick a number between 0 and 20: <input id="number" type="number" min=0 max=20 step = 1 value='10'><button onclick="changeStep();">Change step and max attribute values </button></p>
<p>Click the next image to change its url and size:</p>
<img src="https://www.paris-web.fr/2013/assets_c/2013/08/michel-buffa-thumb-143x143-372.jpg" onclick="changeAndResize(this)" alt="Michel Buffa">
</body>
</html>