I'm struggling to understand why this selector is correctly targeting the txtUsername element:
aspx:
<asp:Content ID="Content1" ContentPlaceHolderID="body" runat="Server">
...
<div class="copy" style="float: left; width: 210px">
<span class="copy" style="float: left; width: 210px">
<asp:TextBox ID="txtUserName" runat="server" CssClass="ffield copy" Style="width: 198px;"></asp:TextBox>
</span>
</div>
jQuery:
var username = $('#body_txtUserName').val();
The ID for the asp:TextBox is txtusername
not body_txtUserName
, the only explanation I can come up with is that the txtusername
is nested within a asp:Content
element with ContentPlaceHolderID="body"
If this theory is correct, what does the underscore signify? I've searched for documentation on this syntax in jQuery selectors but have found nothing