As we discuses as the java script is client side programming,But j query is library which is built using java script .Here we need to observe how to get the id of the text box using jquery in asp.net.The one thing we remember when we working with Jquery is"Include the Library to application".With out add reference we can't perform the functionality.The below example will show how to populate text box using blur event.When the cursor leaves the first text box the then other one will be populate.
<html> <head> <script type="text/javascript" src="~/jquery-1.4.3.min.js" ></script> <script type="text/javascript"> $(document).ready(function() { $("#<%= txtBName.ClientID %>").blur(function(){ var BName = $(this).val(); $("#<%= txtBRname.ClientID %>".val(BName); }); }); </script> </head> <body> Enter Book name: <asp:TextBox ID="txtBName" runat="server"></asp:TextBox> Enter Again:<asp:TextBox ID="txtBRname" runat="server"></asp:TextBox> </body> </html>
No comments:
Post a Comment