在opencart中包含标题部分的wishlist链接中的跨度

mat*_*ewb 6 jquery opencart

我想在我的opencart主题中包含标题部分的wishlist链接的span.

我尝试了以下尝试,但没有成功任何人可以建议更好的方法?

这个工作,但只包装第二个跨度,然后再来到它的默认状态.A CLASS(whis)添加到'添加到WISHLIST'链接

$(document).ready(function(e) {
    $('.whis').click(function(){
        $("#header .links #wishlist-total").wrapInner("<span></span>");     
    });
});
Run Code Online (Sandbox Code Playgroud)

这项工作直到点击产品的"添加到愿望清单"链接.

$(document).ready(function(e) {
     $("#header .links #wishlist-total").wrapInner("<span></span>");            
});
Run Code Online (Sandbox Code Playgroud)

aru*_*nes 1

尝试使用 jQuery .live()函数

$(function() {
    $(".whis").live("click", function(){
        $("#header .links #wishlist-total").wrapInner("<span/>");
    });
});
Run Code Online (Sandbox Code Playgroud)