开发者

How to replace link with list element and then add new link in IE7/8 with jQuery?

开发者 https://www.devze.com 2023-04-13 05:05 出处:网络
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 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>');
});
0

精彩评论

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

关注公众号