Grow your CSS skills. Land your dream job.

Triggering focus with labels?

  • # September 10, 2013 at 6:18 pm

    Hi-
    This seems like an extremely simple question, but perhaps I misunderstand the functionality of <label>‘s.

    I have a set up similar to this:

    <label class="contact-labels" for="first-name">First Name</label>
    <span class="wpcf7-form-control-wrap first-name"><input type="text" name="first-name" value="" size="40" class="first-name" aria-required="true"></span>
    

    From what I understand, when you click on a label, focus jumps to the corresponding input field, however, with what I have above, that doesn’t happen.

    Is there something I’m missing?

    Any advice is appreciated,

    Noel

    # September 10, 2013 at 6:32 pm

    You need an id="first-name"

    http://codepen.io/alenabdula/pen/gtdnl

    # September 10, 2013 at 7:37 pm

    Thank you!!

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".