简体   繁体   中英

how to pass asp:textbox to javascript in jquery

I have a java-script function GetLocation(textbox) which accepts a parameter and called on blur of asp text box in this way <asp:TextBox ID="TextBoxDestAddress" Style="text-transform: uppercase;" onblur="GetLocation(this);" CssClass="address" runat="server"></asp:TextBox> <asp:TextBox ID="TextBoxDestAddress" Style="text-transform: uppercase;" onblur="GetLocation(this);" CssClass="address" runat="server"></asp:TextBox>

I have to call GetLocation function from some where else where I am setting TextBoxDestAddress text property on listbox item selection after this I want to call GetLocation function and pass TextBoxDestAddress as parametere to GetLocation. In bellow code this keyword tells which textbox has text and it works fine

<asp:TextBox ID="TextBoxDestAddress" Style="text-transform: uppercase;" onblur="GetLocation(this);" CssClass="address" runat="server"></asp:TextBox>

but when I fills textbox text from some where else how can I tell to the function that which text box has text in it.

need some sample code

thanks

You can use blue function.

Read the docs: https://api.jquery.com/blur/

$('#TextBoxDestAddress').blur();

Keep attention that in .Net this ID can be different than specified in the .aspx file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM