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



osu schrieb:
> Hi,
>
> Apologies for this noob question, but I really need help and I have
> tried numerous techniques to get this right.
>
> A client has asked me to create an accessible form that has text
> describing what to put in the input area shown within the input.
> However, they don't want a label above it.
>
> To keep the form accessible, I've created a class that positions the
> labels in the form -9999px to the left and used JQuery to add that
> class to the labels so they are visible if Javascript is disabled.
>
> However, I need to use JQuery to show the label text and place it
> within the input so visitors know what each input is for. I can't just
> add value attribute (i.e. <input value ="" /> ) because I'm using this
> for a PHP form variable.
>
> Can anyone help me with this? I assume it can't be too difficult to
> do...right?
>
> Thanks

Reply via email to