Javascript error in Setting focus to a textbox inside a lightbox(Overlay) window.
- by Rishabh Ohri
Hi All,
I have a textbox, a button and a "AdvancedSearch" link on my aspx page. On page load, the focus is set to the textbox. On click of the "AdvancedSearch" link, a lightbox(overlay) window will be opened. I want to set focus to a textbox present within this lightbox window. I am using javascript to achieve this. The code looks somewhat like this:
if( element.type != "hidden" && element.style.display != "none" && !element.disabled ) {
element.focus();
return;
}
when the lightbox window loads, i get a javascript error - "Can't move focus to the control because it is invisible, not enabled, or of a type that does not accept the focus"
Any idea why this error is thrown and why it is not able to set focus to the textbox in the lightbox window?
Thanks,
Rishab.