1) Yes, but not without changing how you do things, you're hiding
stuff with css, so you'll have to change that, and write an initialise
function that hides the labes. The instead of addClass, just do
a .show('slow');
2) Try moving the blur functionality to the focus function, so when
you click outside the form, the last focused object maintains it's
'odd' status.

This'll solve part 2. Part 1 is homework :)

$(function()
{
    $("ul.form").find("input,select,textarea,option")
    .focus(function(){
        $('li.odd').removeClass('odd');
        $(this).parents('li').addClass('odd')
    })
});

[EMAIL PROTECTED] wrote:
> The following function shows/hides a field's label when its focused.
> Adding the class 'odd' gives the label visibility which is otherwise hidden.
>
> $(function()
> {
>     $("ul.form").find("input,select,textarea,option")
>     .focus(function(){$(this).parents('li').addClass('odd')})
>     .blur(function(){$(this).parents('li').removeClass('odd');});
> });
>
> Showing a label, of course, pushes the rest of the page down and hiding
> the label, of course, pulls the page back up. My two questions:
>
> 1. Can this function be modified to use one of jquery's slide/show
> functions?
> 2. How can this function be modifed such that the blur() aspect is
> ignored when the user clicks on the submit button? Unfortunately, user
> clicks submit -> previous field looses focus --> page gets pulled up -->
> by the time the user releases the mouse button, the submit button has moved.
>
> Thanks everyone!

Reply via email to