jQuery 自动完成打开/关闭功能

发布于 2024-08-29 14:49:50 字数 116 浏览 4 评论 0原文

我正在开发一个网站(使用 PHP、MySQL、jQuery 构建),该网站要求管理员在配置中设置一个变量,并根据该配置变量对所有网站启用或禁用 jQuery 自动完成功能。

有什么办法可以实现该功能吗?

I am working on website (built using PHP, MySQL, jQuery) which require that admin set a variable in configuration and according to that configuration variable jQuery autocomplete is enabled or disabled to all website.

Is there any way to achieve that functionality?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

甚是思念 2024-09-05 14:49:50

当然,只需在标题、正文末尾或任何您需要的地方设置一个变量,

echo '<script type="text/javascript">
    var autocomplete= '.$configuration['autocomplete'].';
</script>'; 

然后从那里开始工作即可。

Sure, just set a variable on the header, end of the body, or wherever you need to

echo '<script type="text/javascript">
    var autocomplete= '.$configuration['autocomplete'].';
</script>'; 

and work it from there.

心如狂蝶 2024-09-05 14:49:50

好的,你有一些初始化函数,所以检查自动完成功能是否必须在该函数中打开/关闭,而不是初始化你需要的东西,或者执行它。我在这里没有看到任何需要意识到的问题..

function profiles_autocompletes_init(mode){

        ....check it here.... :)

    $("#"+mode+"ProfileSelecter").autocomplete("/autocomplete/profiles/", {
        ...
    }); 
}

ok, you have some initialization function there, so check if autocomplete must be on/off in that function and not initialize that what you need, or do it. i dont see any problems to realize here..

function profiles_autocompletes_init(mode){

        ....check it here.... :)

    $("#"+mode+"ProfileSelecter").autocomplete("/autocomplete/profiles/", {
        ...
    }); 
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文