Getting textbox value

(JQUERY)


Hi,
In this article i am getting the asp.net textbox value using jquery. Then, display it in the custom dialog.

.aspx page

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script type="text/javascript" src="../Scripts/jquery-1.9.1.js"></script>
    <script type="text/javascript" src="../Scripts/jquery-ui.js"></script>
    <link href="../Scripts/jquery-ui.css" rel="stylesheet" />
 
   <script type="text/javascript">
        function verifyUserName() {
         
            customDialog('you have registered ' +
          $('#<%=TextBox1.ClientID %>').val());
      }

        function customDialog(msg) {

            //for yes or no dialog
            $('#div_sexpired').remove();
            var dialog = $('<div id="div_sexpired"></div>').text(msg);
            $('body').append(dialog);

            $('#div_sexpired').dialog({
                autoOpen: false,
                modal: true,
                title: 'Verify User Name',
                buttons: {
                    "OK": function () {

                        $(dialog).dialog('close');
                        $('#div_sexpired').remove();
                    }
                }

            });

            $('#div_sexpired').dialog('open');

        }
     
        </script>


</head>
<body style="background-color:lightblue;">
    <form id="form1" runat="server">
      
    <div>
        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
       <input type="button" id="btn_verifyusername" onclick="verifyUserName();" value="Verify User" />
    </div>
    </form>
</body>
</html>



Image

Ratings


Average Rating: 0.00 by 0 users
Giri Prasad
7/3/2013
7/3/2013
Download PDF

Comments