jQuery:focus()
我有一个fancybox,ajax调用file.php来获取要显示的内容。file.php包含: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出现之
<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(); }
});
});