您的位置:首页 > 编程语言 > PHP开发

YII的JS处理

2015-02-27 00:00 141 查看
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); ?>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: