开发者

jQuery append not working in Internet Explorer 8

I'm having a problem with jQuery append just in Internet Explorer 8 (I didn't check earlier versions). On launch (in a ready() function) I append a div to my container div. This doesn't work in IE8 though, no div is added. I checked this by returning the length of $('div#options') in the console. Why isn't this working?

This is my code to append the div:

$('div#container').append('<div id="options"><a href="#" id="delet开发者_JS百科e"><a href="#content" id="edit"></div>');

I also tried to use prepend() and appendTo(), but they didn't work either... Can anyone help me?

Thanks!


Perhaps your broken links are causing the issue

$('div#container').append('<div id="options"><a href="#" id="delete">Delete</a><a href="#content" id="edit">Edit</a></div>');


try it like this

 $('#container').append('<div id="options"><a href="#" id="delete">delete</a><a href="#content" id="edit">edit</a></div>');

working demo tested in ie8


In IE it is possible that DOM is not updated after the append. Use another method to ensure if the tag is appended or not. (For example use Developer Tools)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜