Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/73.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
jQuery:focus()_Jquery_Focus_Fancybox - Fatal编程技术网

jQuery:focus()

jQuery:focus(),jquery,focus,fancybox,Jquery,Focus,Fancybox,我有一个fancybox,ajax调用file.php来获取要显示的内容。file.php包含: <SCRIPT> jQuery(document).ready(function($) { $('[name=replyMsg]').focus(); }); </SCRIPT> 我正在使用href函数进行ajax调用 您试图在fancybox出现之前调用focus()。不要将该调用放入ready(),而是将其放入onComplete() 您正在尝试在fancybox出现之

我有一个fancybox,ajax调用file.php来获取要显示的内容。file.php包含:

<SCRIPT>
jQuery(document).ready(function($) {
$('[name=replyMsg]').focus();
});
</SCRIPT>
我正在使用href函数进行ajax调用


您试图在fancybox出现之前调用focus()。不要将该调用放入
ready()
,而是将其放入
onComplete()


您正在尝试在fancybox出现之前调用focus()。不要将该调用放入
ready()
,而是将其放入
onComplete()

    $("a.fancybox_wallConv").each(function(){
       $(this).fancybox({
        titleShow     : false,
        width:    380,
        height:   190,
        autoDimensions: false,
        overlayOpacity: 0.3, 
 showNavArrows: false,
centerOnScroll: true,
        href: "file.php"
      }); 
    });
   $("a.fancybox_wallConv").each(function(){
       $(this).fancybox({
        titleShow     : false,
        width:    380,
        height:   190,
        autoDimensions: false,
        overlayOpacity: 0.3, 
        showNavArrows: false,
        centerOnScroll: true,
        href: "file.php",
        onComplete: function() { $('[name=replyMsg]').focus(); }
      }); 
    });