jquery anchor click doesn't seem to work....

Posted by Pandiya Chendur on Stack Overflow See other posts from Stack Overflow or by Pandiya Chendur
Published on 2010-03-31T11:58:20Z Indexed on 2010/03/31 12:03 UTC
Read the original article Hit count: 161

Filed under:
|
|

Here is function ,

 <script type="text/javascript">
    $(document).ready(function() {
        getRecordspage(1, 5);
        $("a.page-numbers").click(function() {
            alert(1);
            getRecordspage($(this).text(), 5);
            return false;
        });
    });

And in my page i am appending anchors dynamically to this div,

<div id="pager" class="pager">
//my anchors will be present here...
</div>

i am appending anchors dynamically... All anchors will have class="page-numbers"... How it can be done...

When inspected through firebug my pager div had this when i clicked 3,

<div class="pager" id="pager">
<a class="page-numbers prev" href="#">Prev</a>
<a class="page-numbers" href="#">1</a>
<a class="page-numbers" href="#">2</a>
<span class="page-numbers current">3</span>
<a class="page-numbers" href="#">4</a>
<a class="page-numbers next" href="#">Next</a></div>

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about anchor