If we want to report the information that a input field must have in HTML , for example, the attribute "placeholder"
<!DOCTYPE html>
<html>
<body>
<form action="/action_page.php">
<input type="text" name="fname" id="fname" placeholder="First name"><br>
<input type="text" name="lname" if="lname" placeholder="Last name"><br>
<input type="submit" value="Submit">
</form>
</body>
</html>
How could "placeholder"
be used for Javascript code? Taking the value of id
, document.getElementById("fname")