In this article I will explain with an example, how to display TextBox value in JavaScript Alert Box using jQuery.
When the Button is clicked, the TextBox value is displayed in the JavaScript Alert Box.
 
 
HTML Markup
The following HTML Markup consists of an HTML TextBox and a Button.
Name: <input type="text" id="txtName"/>
<input type="button" id="btnShow" value="Show Alert"/>
 
 
Displaying (Showing) TextBox value in Alert using jQuery
Inside the jQuery document ready event handler, the Button has been assigned a jQuery Click event handler.
When the Button is clicked, the TextBox value is retrieved and displayed in JavaScript Alert Box.
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript">
    $(function () {
        $("#btnShow").click(function () {
            var name = $("#txtName").val();
            alert(name);
        });
    });
</script>
 
 

Screenshot
Display (Show) TextBox value in Alert using jQuery
 
 
Browser Compatibility

The above code has been tested in the following browsers.

Internet Explorer  FireFox  Chrome  Safari  Opera 

* All browser logos displayed above are property of their respective owners.

 
 
Demo
 
 
Downloads