works like a charm!

but I dont get it...
-blur is the opposite of focus, right?
-why do you chain it after the focus?
-with [0].defaultValue you restore the first value that was stored in
an array?
-does JS store every changed value of every element in an array?

thx a lot!

On Feb 15, 3:32 pm, Michael Price <[EMAIL PROTECTED]> wrote:
> tlob wrote:
> > $(document).ready(function(){
> >    $("#schnellsuche input").focus(function () {
> >                    $(this).val("");
> >    });
> > });
> > now I want the default value back in, when the focus is not anymore in
> > the input textbox. Can someone put me in the right direction?
>
>  From memory (so it might need tweaking....) you need to chain another
> event to your code up there:
>
> $(document).ready(function(){
>         $("#schnellsuche input").focus(function () {
>                         $(this).val("");
>         }).blur(function() {
>                 if ($(this).val() == "") {
>                         $(this).val($(this)[0].defaultValue);
>                 }
>         });
>
> });
>
> This adds a blur event that says if the value is empty, restore it to
> the element's default value.
>
> Hope this helps. :)
>
> Regards,
> Michael Price

Reply via email to