On Jan 24, 2009, at 5:07 PM, Ramanathan RV wrote:

Hi,

Checkout the non-intrusive labelover plugin. 
http://remysharp.com/2007/03/19/a-few-more-jquery-plugins-crop-labelover-and-pluck/#labelOver
It might be very useful when you decide to write client side validation on the form.

Yeah, I'd strongly recommend that approach, too. I wrote a similar plugin (as I'm sure hundreds of others have) but never made it publicly available. One of these days ...

On Sun, Jan 25, 2009 at 2:14 AM, Karl Swedberg <k...@englishrules.com> wrote:


On Jan 24, 2009, at 12:26 PM, Klaus Hartl wrote:


I assume you use the for attribute to associate labels with their
inputs. Try (of course you need to adapt the selector probably):

$('label').each(function() {
   $('#' + this.htmlFor).val( $(this).text() );
});

--Klaus



Nice one, Klaus!

You could also do it the other way around, iterating through the text inputs instead of the labels:

$('input:text').each(function() {
  $(this).val( $('label[for=' + this.id + ']').text() );
});


--Karl
____________
Karl Swedberg
www.englishrules.com
www.learningjquery.com




--
Thanks
Ram

Reply via email to