Link to home
Avatar of AidenA
AidenA

asked on

jquery: textbox contracts onblur and button beside it moves with it... and can't be clicked?

Hi, as the title suggests, I wondering what's the best way to deal with this situation. I have a textbox and button beside it (on the right side) in a flow layout. I use jquery to expand the textbox to the right which then pushes the button to the right also.

The problem is I want to contract the textbox back to it's original size when it loses focus (onblur even). But, if you have the situation where it loses focus because the user wants to click that button then it doesn't seem to work as the button moves to the left with the contracting textbox, but the click even doesn't appear to have been fired.

How exactly would I get around this situation so that the click even of the button fires before it moves to the left due to the contracting textbox because it's onblur even was fired?

SOLUTION
Avatar of muckeypuck
muckeypuck
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of AidenA
AidenA

ASKER

ok thank for that, just not sure how to implement that yet...

first i need to check if the button hasfocus which i can't quite see how to do? then i need to call the buttons click event... could you provide code example?
if(btnName.Focused)
{
         btnName_Click(null, null);
}

Open in new window

ASKER CERTIFIED SOLUTION
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
Avatar of AidenA

ASKER

solution found