I can't control how the HTML is generated and need to put a string of links into a list and then add new links for each item.
I have simplified the code at http://jsfiddle.net/jhASu/ and it works in Chrome/Firefox and IE9 but not in IE 7 and 8 (no new links are generated). What could be t开发者_如何学运维he cause of this?
Thanks in advance.
http://jsfiddle.net/jhASu/11/
This works I would extract your function a little bit more though: This only adds the anchor to one like you wanted based on the preset value.
Is this what you had in mind?
$('#div1').find('a').wrap('<ul />').each(function() {
$(this).wrap('<li>');
});
精彩评论