我的javascript有一些问题吗

我的javascript有一些问题吗,javascript,jquery,html,tooltip,Javascript,Jquery,Html,Tooltip,我的脚本有一些问题,我使用了JqueryUI工具提示,但它不起作用。 下面给出了示例演示 我希望我的工具提示指示图像petplusvn.com/files/sanpham/16/150.jpg,而不是petplusvn.com/files/sanpham/16/150_1.jpg。您可以使用正则表达式替换src中的URL和原始数据 $(function() { $("a[id*='product_wrap']").tooltip({ content: functio

我的脚本有一些问题,我使用了JqueryUI工具提示,但它不起作用。 下面给出了示例演示


我希望我的工具提示指示图像petplusvn.com/files/sanpham/16/150.jpg,而不是petplusvn.com/files/sanpham/16/150_1.jpg。

您可以使用正则表达式替换src中的URL和原始数据

$(function() {

    $("a[id*='product_wrap']").tooltip({

        content: function(){
            var $html = $(this).html().replace(/150_/g, '');
            console.log('new HTML: '+$html);
            return $html;
        },
    track: true,

    });
});

我认为问题不在于javascript。它只与图像有关。该路径中没有这样的图像。]它有HTML代码中的图像,您可以查看上面的链接,它只在我删除数据原始标记时起作用。但是我不想改变html。
$(function() {

    $("a[id*='product_wrap']").tooltip({

        content: function(){
            var $html = $(this).html().replace(/150_/g, '');
            console.log('new HTML: '+$html);
            return $html;
        },
    track: true,

    });
});