替换文本后未记录日志语句

时间:2016-01-08 12:33:03

标签: javascript jquery google-chrome-extension

我第一次写了一个chrome扩展。 它调用下面提供的内容脚本。 该脚本一直执行,直到替换html,它下面的console.log才会运行。

有谁知道这个的原因? 感谢

background.js:

$(function() {
    console.log( "ready!" );
    var r = /(\£?[0-9]+(\.[0-9][0-9]))/gmi;
    var replaced = $("body").html().replace(r,"<span class='tooltip'>$1</span>");
    console.log("Herro");
    //console.log(replaced);
    $("body").html(replaced);
    console.log("after replacement");
    $('.tooltip').each(function(index) {
        console.log("in here");
        var price = $(this).text;
        price = price.substring(1, price.length);
        console.log(price);

    });

});

0 个答案:

没有答案
相关问题