<!DOCTYPE html>
<html>
<body>
Age:<input id="age" value="18" />
<button onclick="myFunction()">Try it</button>
<p id="demo"></p>
<script>
function myFunction()
{
var voteable;
var age;
age=document.getElementById("age").value; what does .value mean?
voteable=(age<18)?"Too young":"Old enough"; Why are you using the age variabel here?
document.getElementById("demo").innerHTML=voteable;
}
</script>
</body>
</html>
<html>
<body>
Age:<input id="age" value="18" />
<button onclick="myFunction()">Try it</button>
<p id="demo"></p>
<script>
function myFunction()
{
var voteable;
var age;
age=document.getElementById("age").value; what does .value mean?
voteable=(age<18)?"Too young":"Old enough"; Why are you using the age variabel here?
document.getElementById("demo").innerHTML=voteable;
}
</script>
</body>
</html>