Write a jQuery code to demonstrate how to get the value of a textbox.
Answer :
File Name : jQuery.html
<html>
<head>
<script src="https://code.jquery.com/jquery-3.6.0.js" integrity="sha256-H+K7U5CnXl1h5ywQfKtSj8PCmoN9aaq30gDh27Xc0jk=" crossorigin="anonymous"></script>
<title>SP Creation</title>
</head>
<body>
<div class="container">
<div class="col">
<h2>jQuery</h2>
</div>
<div class="col">
<label for="no">Enter Number : </label>
<input type="text" id="text_t" value="">
<p id="t"></p>
</div>
</div>
<script>
$(document).ready(function(){
$("#text_t").keydown(function(){
var text_value = $(this).val();
$('#t').html(text_value);
});
});
</script>
</body>
</html>
No comments:
Post a Comment