我的表单中有一个自动完成小部件。
<?php $this->widget('zii.widgets.jui.CJuiAutoComplete',array(
'name' => 'doctor',
'id' => 'auto',
'source' => MyController::createUrl('autocompleteTest',array('id'=>uniqid())),
'value'=>$dname,
'options' => array(
'showAnim' => 'fold',
'autoFill'=>true,
'minLength'=>'0',
'select'=>"js:function(event, ui) {
$('#Model_name').val(ui.item.id).change();
$('#Model_department').val(ui.item.name).change();
}"
),
'htmlOptions'=>array(
'id'=>'auto',
),
));?>
<script>
$("#auto").bind('focus', function()
{
document.getElementById("auto").value="";
$(this).autocomplete("search");
}
);
</script>
以上代码适用于firefox和chrome,但不适用于IE。在IE中,我收到了一个错误,如“对方法或属性访问的意外调用”。以下代码是问题所在。
append: function() {
return this.domManip(arguments, true, function( elem ) {
if ( this.nodeType === 1 || this.nodeType === 11 ) {
this.appendChild( elem );
}
});
},
我知道这是IE中一个众所周知的问题。但是如何在我的代码中解决这个问题?
答案 0 :(得分:0)
尝试在脚本的头部添加此行
<meta http-equiv='X-UA-Compatible' content='IE=Edge'>