yii2中如何执行JS代码?如何隐藏指定列的搜索框?
答案:
<?php $this->beginBlock('MyJS')?>
// 隐藏指定搜索框
$("input[name='UserSearchModel[userPass]']").hide();
$("input[name='UserSearchModel[createTime]']").hide();
$("input[name='UserSearchModel[expireTime]']").hide();
<?php $this->endBlock()?>
<?php $this->registerJs($this->blocks['MyJS'],\yii\web\View::POS_END);?>
效果图: