jquery - a href nested in DIV element in ASP.NET C# -


my question quite simple, created div, hyperlink control in it. following:

<div id="divone" style="width: 500px;">       <asp:hyperlink runat="server" id="hlone" text="hlone"      navigateurl="http://www.stackoverflow.com" />   </div> 

i created onclick event in jquery div well:

$('#divone').click(function() {       alert('you clicked on div element');   }); 

my goal trigger event when div area clicked (working fine), but- when hyperlink clicked, need page redirect without triggering div 'onclick' event (can use javascript or jquery needed).

thanks all!

to this, stop click event bubbling using event.stoppropagation(), this:

$('#divone a').click(function(e) {     e.stoppropagation(); }); 

return false; stop bubbling...but stop link being followed, that's why have .stoppropagation() :)


Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -