jQuery(...).activeform 不是 Yii 中的函数 [英] jQuery(...).activeform is not a function in Yii

查看:20
本文介绍了jQuery(...).activeform 不是 Yii 中的函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在用 Yii 开发一个项目.

I am developing a project with Yii.

我需要在站点的许多页面上使用 jquery ui.所以我在站点的布局中添加了 jquery 核心库和 jquery ui 库,以便在所有页面上访问它们.

I need to use jquery ui on many pages of site. So I add jquery core library and jquery ui library in the layout of site to have access to them on all the pages.

但它会导致具有表单(活动表单)的页面出现问题.我在萤火虫上看到了这个错误:

But it causes problem on the pages which have a form (active form). I see this error on the firebug :

jQuery(...).activeform is not a function

为什么会这样?我该如何解决?

why is it so? How can I resolve it?

谢谢.

推荐答案

如果您在布局文件中手动包含 jQuery 核心库,则 jQuery 可能会再次加载并覆盖具有 Yii 的原始 jQuery 对象附上插件.

If you include jQuery core libraries manually in your layout file, it could be possible that jQuery gets loaded a second time and overrides the original jQuery object which had the Yii plugins attached.

你应该使用 Yii::app()->clientScript->registerCoreScript('jquery.ui') 代替.

这篇关于jQuery(...).activeform 不是 Yii 中的函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆