Reputation: 295
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
Upvotes: 0
Views: 104
Reputation: 13038
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" />
Upvotes: 2
Reputation: 5650
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.ClientID %>
Upvotes: 2