1.$this->registerJsFile('@web/other/jquery.autocomplete.min.js',['depends'=>['yii\web\JqueryAsset'],'position'=>yii\web\View::POS_HEAD])
2.$this->registerCssFile('@web/other/jquery.autocomplete.css');php
3.$this->registerJs($jsstring)
4.$this->registerCss($cssstring)css
此外在在view裏臨時寫些代碼段的話這樣子 jquery
<?php $this->beginBlock('myjs') ?>web
$("trainclassselect-year").click(function(){yii
$(this).hide();ide
});this
<?php $this->endBlock() ?>string
<?php $this->registerJs($this->blocks['myjs'], \yii\web\View::POS_LOAD); ?>it