Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Setting focus to a DIV
Message
 
To
28/09/2012 09:37:36
General information
Forum:
HTML5
Category:
HTML
Miscellaneous
Thread ID:
01553827
Message ID:
01553923
Views:
51
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?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform