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');
3.$this->registerJs($jsstring)
4.$this->registerCss($cssstring)
此外在在view里临时写些代码段的话这样子
<?php $this->beginBlock('myjs') ?>
$("trainclassselect-year").click(function(){
$(this).hide();
});
<?php $this->endBlock() ?>
<?php $this->registerJs($this->blocks['myjs'], \yii\web\View::POS_LOAD); ?>