开发者

Setting Focus after Div Animation

I'm trying to set the focus to an element in a hidden div, after I call the Show method. Here is the code:

//Show the Bottom Div
$('#dvBottom').show('medium', function()
{
    switch (hdnGenerateScaffoldCount.value.toUpperCase())
    {
       case "Y":
          $('#dvManualDocumentID').show('fast', function()
          {
             $('#txtScaffoldCountSheetNumber input').focus();
          });
       break;
       default:
          $('#txtJobs input').focus();
       break;
    }
});

the two divs display properly, but focus is always on the Address bar of the browser. I've tried this in IE8 Strict and FF and the same behavior happens in both.

I've stepped through the code and the following is executed:

$('#txtScaffoldCountSheetNumber input').focus();

I've even set the value to "Hello World" on Focus, and the text appears, but the focus is always lost. I have nothin开发者_JAVA技巧g else going on in this script and I appreciate any help

Terry P.S. The HTML Renders fine. Both Div's are visible by default and hidden on page load in jquery.


Divs can't receive focus without @tabindex set, try:

<div tabindex="-1"></div>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜