val()
MethodYou can simply use the jQuery val()
method to get the value in an input text box.
Try out the following example by entering something in the text input box and then click the "Show Value" button, it will display the result in an alert dialog box.
<!DOCTYPE html>
<html lang="en">
<head>
<title>jQuery Get the Value of an Input Text Box</title>
<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
<script>
$(document).ready(function(){
// Get value on button click and show alert
$("#myBtn").click(function(){
var str = $("#myInput").val();
alert(str);
});
});
</script>
</head>
<body>
<input type="text" id="myInput">
<button type="button" id="myBtn">Show Value</button>
</body>
</html>
Hi, My name is Harsukh Makwana. i have been work with many programming language like php, python, javascript, node, react, anguler, etc.. since last 5 year. if you have any issue or want me hire then contact me on [email protected]
Laravel 8 Create Custom Service Provider Example
In Laravel application, you have noticed...Angular 12 HTTP get request example using HttpClient module
Every front-end application needs to com...How to count all elements or values in an array in PHP
Use the PHP count() or si...Javascript beautiful sweetalert2 plugin
Sweetalert2 is opensource simple and sta...How to install tar.gz or tar.bz2 file in Ubuntu
In modern Linux distribution, almost sof...