views:

84

answers:

1

Hello

I am trying to find a solution to a simple thing, that looks complex!

I have a textarea where users can update their status. Underneath it I have a checkbox (ex: for the user to choose to tweet the status or no).

What I try to do is this: 1/ When the textera get the focus, the textarea expands, for that it's fine.

2/ When the textarea loose focus, so when the user clicks out of it, it collapse. That's fine too...

The only problem is that if the user click on the checkbox, the textarea collapse too but I want to prevent it.

It should collapse and execute the function on blur, but not if the user try to interact with the checkbox.

I set up an example on this page: http://favosaurus.com/dev/onblur.php

thanks for your suggestions.

A: 

You're going to need to use Javascript.

Pseudocode:

if input blur,  and checkbox not clicked:

     do normal blur action.

else:

     process checkbox click
     focus input again
Michael Robinson
Does this take into account the fact that the blur event on the textbox occurs before the focus event on the checkbox?
Kev