Hi all,

I am designing a calculator using <div> as a container. This div has lots of <input> tags. Even there are some dynamic tags that are created using javascript. I want user to use tab key to navigate to next elements within the div only. ie, I dont want the user to loose focus from calculator when he presses tab key while on the last element of the <div>

I tried to capture document.onkeypress and check the target element if it is a child of our div. If the event target is a child element of our div, then continue navigation otherwise ignore tab key and set focus to the first element of the div.

But there is a small problem. when the user is on the last element of our div, then also our condition will be true and the navigation will leave the div to the next element of the document(which I dont want) and if the user presses tab again it will come back to the first element of our div.

If anybody knows how to get out of this, it will be great....

Thanking you in advance...

Afru.