Reputation: 2618
I am currently selecting an
<asp:Label id="lblLoginusername"..../>
So I am trying to get a reference to it (to later on change its value) by writing the following in my google chrome browser:
$("#<%= lblLoginUsername.ClientID%>")
I DO have jquery (1.7.2.min) in my page, but unfortunately I am getting:
[Exception: Error: Syntax error, unrecognized expression: >]
Can anyone guide me as to where I have a silly mistake?
Upvotes: 0
Views: 597
Reputation: 5313
first i dont know the exception if it was server side exception then the problem will be from your asp tag , recheck how you written the syntax
in jquery when selecting an element you select by its html attribute not by its asp.net properties and the ID tag in asp.net is not equal to the id attribute in html , so what you can do is figuring out the id attribute is from the generated html , or add a class name the select by that class
what your doing in chrome is writing $("#<%= lblLoginUsername.ClientID%>")
that means find the element on page that its id attribute equal to "#<%= lblLoginUsername.ClientID%>"
wich is not html at all its asp.net command, the browser wont undrstand it
`
Upvotes: 1