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.
Asked
Active
Viewed 2,268 times
-2

user1477886
- 263
- 1
- 6
- 19
-
check this thread [pagination-with-javascript](http://stackoverflow.com/questions/6060775/pagination-with-javascript). and search first before post – Nikson Kanti Paul Jul 10 '12 at 10:00
-
http://stackoverflow.com/questions/11242974/ajax-jquery-related-how-to-call-ajax-on-a-ajax-loaded-page/11243250#11243250 Please check this url there is a answer of your questions – Jalpesh Patel Jul 10 '12 at 10:03
-
I need also to take information about links. – user1477886 Jul 10 '12 at 10:04
-
1Use actual `` tags so that users who don't or can't use a mouse can still use your page. (Your JavaScript code would then intercept the click event and prevent default `` tag behaviour.) – nnnnnn Jul 10 '12 at 10:38
1 Answers
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