Add jquery in Yii 2.0

jquery, php, yii2

Solution

Solved! I forgot to put the view methods in my view file: (`$this->beginBody()` and so on)

Problem

How can i add jQuery to my page in Yii 2.0? In Yii 1.x you could just use: ``` Yii::app()->clientScript->registerCoreScript('jquery'); ``` I already tried to override the View class with my own and tried to register jQuery there, but it doesn't shows up in my html page: ``` namespace frontend\components; /** * This is the base view object, it extends the yii\web\View so you can add custom view stuff here. */ class BaseView extends \yii\web\View { public function init() { parent::init(); \yii\web\JqueryAsset::register($this); } } ```

Original source