javascript - Unable to set focus to text box after custom popup -
i'm showing fancy box message , after message i'm trying set focus textbox.but not working
here html code
<a class="fancytrigger" href="#thefancybox"></a> <hr> <div id="thefancybox"></div> powered <a href="http://fancybox.net/" target="_blank">fancybox</a> <input id="ipt" type="textbox" />
javascript code
$("#thefancybox").html("<p>just adding paragraph demonstrate can dynamically create html content within div using .html()</p>"); $(".fancytrigger").fancybox(); $(".fancytrigger").trigger('click'); $('#ipt').focus();
and here demo jsfiddle
this work fancybox 2.0.
$(".fancytrigger").fancybox({ aftershow : function() { $('#ipt').focus() }, afterclose : function() { $('#ipt').focus() } });
Comments
Post a Comment