kannix
kannix

Reputation: 5157

html label for attribute has no effect

I'm trying to improve this contact form: [link removed] i wanted to add correct labels, to set the input focus if you click the name. Therefore i've added an id to the name field and the for="name" attribute to my label. In a clean page with only that label and input in it it works as expected.. but in that page it doesn't work.

Does anyone have a hint why that isn't working?

Edit: I know that the other labels and fields can't work.. i've just changed the first input to try things out ;)

<li><label for="name">Name</label><span class="wpcf7-form-control-wrap name"><input type="text" name="name" value="" id="name" class="wpcf7-form-control wpcf7-text wpcf7-validates-as-required" size="40"></span></li>

Edit: the used form plugin seems to be messy and i'll try to switch to wordpress jetpack forms.. so question is solved

Upvotes: 0

Views: 1843

Answers (1)

Carlos Vergara
Carlos Vergara

Reputation: 3622

Double check your code. Look at this:

<li><label for="Name">Strasse </label> <span class="wpcf7-form-control-wrap Strasse"><input type="text" name="Strasse" value="" class="wpcf7-form-control wpcf7-text" size="40" /></span></li>
<li><label for="Name">PLZ </label> <span class="wpcf7-form-control-wrap PLZ"><input type="text" name="PLZ" value="" class="wpcf7-form-control wpcf7-text" size="40" /></span></li>
<li><label for="Name">Ort </label> <span class="wpcf7-form-control-wrap Ort"><input type="text" name="Ort" value="" class="wpcf7-form-control wpcf7-text" size="40" /></span></li>

You're using for="Name" several times.

Upvotes: 3

Related Questions