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