Reputation: 1641
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="delete"><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!
Upvotes: 3
Views: 10492
Reputation: 1990
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)
Upvotes: 1
Reputation: 17640
try it like this
$('#container').append('<div id="options"><a href="#" id="delete">delete</a><a href="#content" id="edit">edit</a></div>');
Upvotes: 4
Reputation: 1428
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>');
Upvotes: 10