Thank everyone for replay - I cannot post the code - it much
complicated
There is no hidden - so input1 must appear without any problem, but
its maybe that there are a lot of HTML markup in a page and browser
has to have a time to render the content so .focu() is executed before
appering the input1 on a page

I'll try to refactor the code and I'll try your suggestions.

thank you very much.

On 7 июн, 09:23, "T.J. Crowder" <t...@crowdersoftware.com> wrote:
> Hi,
>
> Without showing us the actual code you're using, it's a bit hard for
> people to help you.  You don't want to go overboard, but you do want
> to show the complete series of lines that isn't working as you expect.
>
> > before now I believed that script engine doesnt go to the next
> > operator untile the previous operator complits and content is rendered
> > and ready to use. But now I see that its not true
>
> I heard early on that you couldn't rely on that, and so I usually put
> in a defer after adding content before I try to reference the content:
>
> * * * *
> div.update('<input type="button" id="input1" value="Hi there" />');
> (function(){ $('input1').focus(); }).defer();
> * * * *
>
> Usually I wrap up several things I want to do with the updated content
> into the same defer; if you find you want to just focus an element
> after a pause, you're probably best off creating a function and
> reusing it:
>
> * * * *
> function focusElement(id) {
>     $(id).focus();}
>
> ...
> div.update('<input type="button" id="input1" value="Hi there" />');
> focusElement.defer('input1');
> * * * *
>
> HTH,
> --
> T.J. Crowder
> tj / crowder software / com
> Independent Software Engineer, consulting services available
>
> On Jun 6, 3:33 pm, buda <www...@pochta.ru> wrote:
>
>
>
> > I do
>
> > var cont = '...<input id="input1"...'.makeElement(); -- put string to
> > innerHTML in tmp div and return divs first child;
>
> > div.update(cont);
> > $(input1).focus();
>
> > when i call $(input1).focus(); - an error occures - 'Can't move focus
> > to hidden or ....'
> > before now I believed that script engine doesnt go to the next
> > operator untile the previous operator complits and content is rendered
> > and ready to use. But now I see that its not true
>
> > Help me please - how to set focus to input1 after div.update(cont)?- Скрыть 
> > цитируемый текст -
>
> - Показать цитируемый текст -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to