How to use jquery/javascript in yii?,
How to use my Script in yii?
Why is this any different from using jQuery in any other way?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
As you stated above you can either register a new script block or you can register a new external script file. You cna also register assets within plugins which will take entire JS folders and combine them into your app.
So there are many ways to use JQuery in Yii.
JQuery comes pre-bundled and activated with JQuery and the JQuery library itself is considered a core script so there is no real need to put your own JQuery in.
You can overwrite the built in JQuery with your own by putting:
Something like that somewhere within either your layout, action or view. I prefer to put this within the layout and manage my own JQuery version personally.
Mainly due to standardisation and interoperability of the framework and its components. Coming pre-bundled with built in hooks for JQuery UI widgets and JQuery elements in general makes the framework much easier to build reusable and clean JS objects for use in your app.
Also I like JQuery so it makes sense for it to come pre-bundled in my opinion. However this is not a call to arms for JQuery being the only JS library/framework out there and you should really consider which is best for you before you choose.