Possible Duplicate:
Using jQuery to test if an input has focus
I need to check if a particular textbox has the focus or not using jQuery. So my code is like this, but it is not working:
if (document.getElementById("lastname").focus = true) {
alert("hello");
}
My use-case is this: I have a textbox which should be shown or hidden when the #lastname
textbox gains or loses focus. However, if the #lastname
textbox loses the focus to the other textbox, the latter should remain visible until it loses focus as well.
Any help will be appreciated.