In this post I'm showing you how to get TextBox value and use them in jQuery
This method will work on both HTML control and ASP control
1. First we will define a TextBox assign it id="txt1"
Following is the sample
This method will work on both HTML control and ASP control
1. First we will define a TextBox assign it id="txt1"
<input type="text" id="txt1" /><br />2. Now we will create a button, and assign it id="btnSubmit"
<input type="submit" value="Click" id="btnSubmit" />3.Now we will write the required jQuery code so that when the user click on the button, we will get an alert of textbox Text
1: <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"
type="text/jscript"></script>
2: <script type="text/jscript">
3: $(document).ready(function () {
4: $("#btnSubmit").click(function () {
5: alert($("#txt1").val());
6: });
7: });
8: </script>
Following is the sample
Type A Text and Click on Submit button
No comments:
Post a Comment