jQuery wrap正在强制执行多个文档就绪回调

jQuery wrap正在强制执行多个文档就绪回调,jquery,Jquery,我有以下代码: function CreateRoundbox(selector, scope) { $(selector).wrap('<div class=\"' + scope + ' dialog\"><div class=\"bd\"><div class=\"c\"><div class=\"s\"></div></div></div></div>'); $('div.'

我有以下代码:

function CreateRoundbox(selector, scope) {
    $(selector).wrap('<div class=\"' + scope + ' dialog\"><div class=\"bd\"><div class=\"c\"><div class=\"s\"></div></div></div></div>');
    $('div.' + scope).prepend('<div class=\"hd\"><div class=\"c\"></div></div>').append('<div class=\"ft\"><div class=\"c\"></div></div>');
}
以前有人碰到过这个吗?我用包装纸错了吗

更新


修正了用法行,我不小心在范围文字中添加了一个点

我很困惑,为什么都被转义了?@Zuul-lol。。。我想他就是喜欢这样。。。但这不是问题。。是吗@赖格尔,哈哈。。。没有,但我只是看着它,无法抓住我的头围绕它;嗯…这是我支持的旧代码。如果你想谈论它的象征意义,我非常高兴,但是,它与真正的问题没有任何关系…document.ready在页面上被多次调用。调用代码是什么?有没有可能通过点击一个a元素来调用它?我明白你的意思了…我会更新上面的例子…我只是输入了用法,然后把它搞砸了;哈哈,投了反对票。。。我希望至少解释一下原因。。。为了进一步完善答案;是的,因为这与实际答案没有关系,我留下了一条带解释的评论,更不用说问题的更新了。如果这是对这个问题的回答,它会得到一次投票。有意义吗?谢谢@reigel。如前所述,这是一个打字错误。我很感激你帮我把它说出来,但打字错误不是故意的。记住对问题进行向上/向下投票的原因……这样其他人就可以得到问题的最佳答案……这样一来,一旦错字被删除,这与回答问题无关。没有什么私事,所以我的朋友并不代表一切;
function CreateRoundbox(selector, scope) {
                            //           v----> this will result to class=".roundbox-wrapper", which is, I guess, not the thing you want in there.. :)
    $(selector).wrap('<div class=\"' + scope + ' dialog\"><div class=\"bd\"><div class=\"c\"><div class=\"s\"></div></div></div></div>');
    $('div.' + scope).prepend('<div class=\"hd\"><div class=\"c\"></div></div>').append('<div class=\"ft\"><div class=\"c\"></div></div>');
   //     ^    ^
   //     |    |--- look at scope.... then, look here at the second argument, CreateRoundbox(".roundbox", ".roundbox-wrapper");
   //     |--- look at the dot.... :)   CreateRoundbox(".roundbox", ".roundbox-wrapper");

}
function CreateRoundbox(selector, scope) {
                            //           v----> this will result to class=".roundbox-wrapper", which is, I guess, not the thing you want in there.. :)
    $(selector).wrap('<div class=\"' + scope + ' dialog\"><div class=\"bd\"><div class=\"c\"><div class=\"s\"></div></div></div></div>');
    $('div.' + scope).prepend('<div class=\"hd\"><div class=\"c\"></div></div>').append('<div class=\"ft\"><div class=\"c\"></div></div>');
   //     ^    ^
   //     |    |--- look at scope.... then, look here at the second argument, CreateRoundbox(".roundbox", ".roundbox-wrapper");
   //     |--- look at the dot.... :)   CreateRoundbox(".roundbox", ".roundbox-wrapper");

}