Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
I'm creating a new web project and i trying to get jQuery working with masterpages
I want to have a link that if it is pressed will do an expansion of a div.
Problem: jQuery isn't fired and the page do a postback
ASP.NET control IDs are not the same as JavaScript element IDs. ASP.NET modifies IDs before sending them to the client. In your .aspx file's JavaScript, instead of simply hp1, specify something like:
hp1
<%= hp1.ClientID %>
Add a comment
You can set
ClientIdMode="Static"
if you are using Visual Studio 2010
If not, you can always use a CSS selector like
$('.YourControl').click(function(){ alert('hi'); });
And in your aspx
<asp:HyperLink ID="yourId" cssClass="YourControl" />
Do not use asp:HyperLink, instead use just a
Required, but never shown
By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.