Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Setting focus to a DIV
Message
 
À
28/09/2012 09:37:36
Information générale
Forum:
HTML5
Catégorie:
HTML
Divers
Thread ID:
01553827
Message ID:
01553923
Vues:
50
You don't need the form - just an input box should work.

But then why would you need to focus a < div > exactly? If you just want to scroll to the position you might want to look at scrollIntoView:

https://developer.mozilla.org/en-US/docs/DOM/element.scrollIntoView

AFAIK, if you use jQuery("#divElement").focus() it will actually become visible/focused. Not 100% sure but you might want to try that first.

+++ Rick ---

>I have a DIV. This DIV does not always contains a form. But, once this DIV is shown, it needs to receive the focus. IE supports loDiv.focus(), for example. That works. But, Firefox does not support that. So, we have to come up with a workaround for Firefox. One idea was to create a form which just one INPUT Type=Text on top of my div and set the focus to that field. But, the problem is that such an approach requires to hide the form. And, of course, as you would have known it, if a form is hidden, it cannot receive a focus. In order for something to receive a focus, it need to be visible. But, some of my DIV does not contain a form thus this complicates things to have the focus on it.
>
>Any idea?
+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform