Reputation: 289
The following code does not work
<!DOCTYPE html>
<html>
<body>
<input type="text" id="searchTxt"/>
<input type="button" id="run"/>
<script>
$(document).ready(function() {
$("#run").click(function(){
var input = document.getElementById("searchTxt");
alert(input);
});
});
</script>
</body>
</html>
How can I get and print the value in the text box ?
Upvotes: 0
Views: 68
Reputation: 453
You have to include the jQuery JS file inside your <head>
tag.
<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
Upvotes: 2