+ 3
Why it doesn't work??
4 Answers
+ 7
little modified now its working
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<input type="text" id="text">
<button onclick="a()">Ok</button>
<script>
function a(){
var x=
document.getElementById("text").value;
alert("Welcome " + x)
}
</script>
</body>
</html>
+ 3
Why my code is wrong??
+ 2
at onClick is event where in script it runs as funnction and i afarid it dosent tale inline script
0
Why can't we write document.getElementById("text").value;
at the onclick??