Set Focus on Container

Set Focus on Container

Hi guys,

I've seen arround some topics, but I couldn't make it work anyway.
My idea is with a link, with a SUBMIT method to an action, with a RunJavaScript with the folowing:

"function setFocus(){
document.getElementById('" + container.Id + "').focus();

Is this suposed to work?
Hello Francisco,

the method .focus() is implicitly applicable to a limited set of elements, such as form elements (< input />, < select>, etc.).

In other words it puts the cursor on that element.

is that what you want to achieve? i cannot understand well what you really want.

Hi Miguel,

Thanks for your reply, and I think that does not work for me.
The goal is a FAQ.
I will have the Questions on top, and then I imagined to get every question/answer into a container, and when you press the question on the top, I want it to focus on the container that has the answer. Did I made myself clear now ?
If you want, I can upload the .oml.
Thanks !
Hello Francisco,

well i think now i know what you want, and they are called anchors. 

take a look on this page. Where you have the Contents sections and you can click to go to the content details.

An anchor is created using the < a > tag. If you want to create an anchor called chapter4, you simply add this line where you want the anchor to be:

<a name="chapter4"></a> 

After doing this, you can make a link pointing to the anchor using the normal < a href> tag, like this:

Click <a href="#chapter4">here</a> to read chapter 4. 

This is using HTML, there also other options like jQuery using the ScrollTo plugin, for example.

Brilliant !
I got the idea that I should do it by the setfocus.
Thank you very much ! :)