how to load jQuery 1.7 instead of default 1.6.1?

I am using jQuery on() function, which is only available on jQuery 1.7.

I tried to load it by putting <script src=""></script> in <head>

But the result is still 1.6.1 (alert($.fn.jquery); can tell), becasue Yii automatedly place its code after my script link.

        how do I tell Yii to load jQuery 1.7?

Thank you!


edit the file


and point the basePath of the jquery package to your jquery file

As it’s not good to modify framework core files… there are other options that can be used…

If you add jQuery manually… then you just need to disable the Yii automatic inclusion of it’s jQuery by using the scriptmap - http://www.yiiframew…criptMap-detail


you can configure Yii to use the google CDN version instead of the included one… check this wiki article for this solution - http://www.yiiframew…om-google-s-cdn

I am not very capable programmer, so I’ll pass the idea of changing source code. But thanks a lot, Gustavo!

Here is how I solve my problem based on reply from mdomba:

in main.php






                        	'baseUrl'=>Yii::app()->request->baseUrl . '/js',

                        	'js'=>array('jquery-1.7.js'))) ),


There are a lot of arrays here. You have to be very clear which is in side which. I think it’s one of the biggest challenges for newbies like me:)

OT: You’ve used indent and that is IMHO the best way to get yourself in associative arrays like this! ;]

BTW: I wouldn’t call a newbie someone who has 200 posts on account on this forum! :]