Javascript: Tab Index - Focus
I need some help. It is all about tab index. I have a javascript that uses document.getElementById('name').focus(); where the textbox_1 with the id='name' is focus. The problem is
Solution 1:
This demonstrates how to save focus in localstorage when page is reloaded or re-visited.
<input id="text1" type="text" onfocus="savefocus(this)">
<input id="text2" type="text" onfocus="savefocus(this)">
var ls=window['localStorage'],
focus=ls.getItem("onfocus") || "text1",
savefocus=function(e){ls.setItem("onfocus", e.id)};
document.getElementById(focus).focus();
Post a Comment for "Javascript: Tab Index - Focus"