John
John

Reputation:

jquery appendTo() not working in IE 7,8

I am using jquery to do paginations. My code is wroking fine in FF but in IE it says the error on linee 255 in jquery.js

and its is on the append function

what should i do

var $pager = $j('<br><span class="pager"></span>');
$j('<span class="page-number" >' + (page + 1) + '</span>')
.appendTo($pager).addClass('clickable').addClass('over');

This is not the full code but the error is due to appendTo line , if i remove that line then there is no error

Upvotes: 0

Views: 636

Answers (2)

jerjer
jerjer

Reputation: 8760

How about not using appendTo:

var $pager = $j('<br><span class="pager"></span><span class="page-number" >' + (page + 1) + '</span>').addClass('clickable').addClass('over');

Does this make sense?

Upvotes: 1

joshperry
joshperry

Reputation: 42227

I think the <br> is messing it up, try it with $pager referencing only the <span/>.

var $pager = $j('<span class="pager"></span>');
$j('<span class="page-number" >' + (page + 1) + '</span>')
    .appendTo($pager)
    .addClass('clickable')
    .addClass('over');

Upvotes: 0

Related Questions