Javascript 触发类型文件事件时发生未捕获范围错误
这是单击事件代码Javascript 触发类型文件事件时发生未捕获范围错误,javascript,jquery,wordpress,file-io,contact-form-7,Javascript,Jquery,Wordpress,File Io,Contact Form 7,这是单击事件代码 function jqueryscript_in_head(){ ?> <script type="text/javascript"> $j = jQuery.noConflict(); $j(function() { $j("input[type=file]").wrap("<div class='hider' style='height:0px;width:0px;' />");
function jqueryscript_in_head(){ ?>
<script type="text/javascript">
$j = jQuery.noConflict();
$j(function() {
$j("input[type=file]").wrap("<div class='hider' style='height:0px;width:0px;' />");
$j(".hider").wrap("<div class='fileinputimg' />");
$j(".fileinputimg").on("click", this, function(e) {
$j("input[type=file]").trigger('click');
});
});
</script> <?php
} add_action('wp_head', 'jqueryscript_in_head');
函数jqueryscript\u in_head(){?>
$j=jQuery.noConflict();
$j(函数(){
$j(“输入[类型=文件]”)。换行(“”);
$j(“.hider”)。包装(“”);
$j(“.fileinputimg”)。单击此函数(e){
$j(“输入[type=file]”。触发器('click');
});
});
我用这个设置成功了。有人能告诉我为什么之前的设置不起作用吗?