Currently my aspx page contains
<input type="text" name="openid_username" />
<input type="text" name="openid_identifier" />
but now i would like to replace them with
<asp:TextBox ID="openid_username" runat="server"></asp:TextBox>
<asp:TextBox ID="openid_identifier" runat="server"></asp:TextBox>
so how should i modify the following JQUERY, to reflect the input boxes to textboxes replacement?
var $usr = $this.find('input[name=openid_username]');
var $id = $this.find('input[name=openid_identifier]');
I would use the "ends with" option on the attribute selector in case the name is mangled by the control being in a container. Note the $=
instead of =
.
var $usr = $this.find('input[name$=openid_username]');
var $id = $this.find('input[name$=openid_identifier]');
If you want the exact ID of your controls, you can do this:
var $usr = $this.find('#<%= openid_username.ClientID %>');
var $id = $this.find('#<%= openid_identifier.ClientID %>');
Of course, this is assuming your JS isn't in an external file.
var $usr=$("#openid_username");
should work or try
var $usr = $('[id*=openid_username]');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With