-2

I'm developing a pagination for some site and I need to use Ajax for page changing, therefore I need to print links to "1", "2", "3" pages, with "<a>" tag. I understand that I need to add Javascript event handler for click by this link, but I needn't that user goes by link, I only need that "1","2","3" look like link. What should I do? Is there any way to make digits look like links? And how can I add Javascript event handler for click by link? Thank you in advance.

user1477886
  • 263
  • 1
  • 6
  • 19

1 Answers1

0

Instead of insert tags, just insert <span> tags.
Give them a particular class and then handle click with javascript.

Your html code could looks like:

<span class="my_link">1</span> <span class="my_link">2</span> <span class="my_link">3</span>  

In your css you can isert the link-style hand on hover with the rule:

.my-link { cursor: pointer }

and then, with JS and jQuery, handle the click

<script type="text/javascript">
  $('.my-link').click(function(){ #your stuff...  });
</script>
ilSavo
  • 854
  • 1
  • 8
  • 28