gpt4 book ai didi

jquery - 我可以在 JQuerify 等书签中使用 JQuery 插件吗

转载 作者:行者123 更新时间:2023-12-01 04:28:23 24 4
gpt4 key购买 nike

我想以与 jQuerify 书签相同的方式使用 tablesorter 插件。

我应该如何自己做这件事,或者可以在某个地方找到它吗?

最佳答案

将其放在小书签代码的开头:

var s=window.document.createElement('script'); s.setAttribute('src','http://code.jquery.com/jquery-latest.min.js'); window.document.body.appendChild(s);

这基本上包括 jQuery 库。

编辑:此外,如果这仅供个人使用,您可能需要在计算机上保留 jQuery 的本地副本,并将脚本的目的地指向那里。未经许可使用其他服务器的资源实在是太不体贴了。

Edit2:抱歉,我误读了你的问题。修改后的代码如下:

javascript:(function(){
var s=window.document.createElement('script');
s.setAttribute('src','http://code.jquery.com/jquery-latest.min.js');
window.document.body.appendChild(s);
var s2=window.document.createElement('script');
s2.setAttribute('src','http://tablesorter.com/jquery.tablesorter.min.js');
window.document.body.appendChild(s2);
$('table').tablesorter();
})();

我把它分成不同的行,这样更容易阅读。这是一个精简版本:

javascript:(function(){var s=window.document.createElement('script');s.setAttribute('src','http://code.jquery.com/jquery-latest.min.js');window.document.body.appendChild(s);var s2=window.document.createElement('script');s2.setAttribute('src','http://tablesorter.com/jquery.tablesorter.min.js');window.document.body.appendChild(s2);$('table').tablesorter();})();

关于jquery - 我可以在 JQuerify 等书签中使用 JQuery 插件吗,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4653298/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com