jquery - Javascript - cannot stop link from loading page -


i have link element (actually, links of class) have bound click event.

here's example link element:

<a id="2" class="paginationclick" style="cursor: pointer;" href="">2</a> 

and here's binding:

$(".paginationclick").click(function(e) {     displayaccountsearchresults(e);      if (e.stoppropagation) {         e.stoppropagation();     } else {         e.cancelbubble = true;     } }); 

displayaccountsearchresults(e) executes fine page reloads. not want page reload. why isn't stoppropagation / cancelbubble working?

you need e.preventdefault

$(".paginationclick").click(function(e) {     e.preventdefault()      displayaccountsearchresults(e);      if (e.stoppropagation) {         e.stoppropagation();     } else {         e.cancelbubble = true;     } }); 

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -