Solution/alternative to href="#"

Asked

Viewed 44 times

1

I’m using ajax paging, and every time I click to the next page, the browser goes back to the top because of # that’s on the href.

<a href="#" onclick="getitens('+(pagina-1)+', '+numitens+')">Página Anterior</a>

Is there any other character for the href, or some way to undo the action? I thought to add '\\', but when I did, the browser sent to the home page.

  • Have you tried giving one return false; at the end of that function getitens?

  • No, what I just tried was to add a href="javascript: void(0)" and href="javascript:;", which until then worked. Should I really wear?

  • It’s exactly the same, although they differ in type.

  • Perfect. Now I’ll be creating another question, which is page-related, if you can help. The title will be'Pagination in ajax does not display numbers, just previous/next'. Thanks in advance!

  • 2

    In addition to the answer I marked as duplicate of this one, it is also worth seeing this answer: http://answall.com/a/6634/129

  • It has already been finished. Anyway, thank you! Tranquil Sergio, I solved minutes before.

Show 1 more comment
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.