Forums

[Plugin: Contact Form 7] clear input labels (4 posts)

  1. Ziggii
    Member
    Posted 2 months ago #

    Is it possible to clear the labels placed in the input field?
    Example, I have an email field, in this field is the word "Email". As soon a visitor clicks on it to enter his email the word (label) should dissappear. Is there a way to create this?

    http://wordpress.org/extend/plugins/contact-form-7/

  2. digitz
    Member
    Posted 2 months ago #

    This would be a useful option indeed.

  3. Ziggii
    Member
    Posted 2 months ago #

    I have tried this post but can't figure out how to let this work with contactform 7.

  4. emj
    Member
    Posted 1 week ago #

    hmm, I had the same problem and got textboxes working like this:

    a) add this javascript to header.php

    function clearText(field)
    {
    if (field.defaultValue == field.value) field.value = '';
    }

    (thanks http://www.bradino.com/javascript/clear-textfield-default-value-onclick/)

    b) in the contact form 7 plugin folder, edit file /modules/text.php

    c) find line 76
    $html = '<input type="text" name="' . $name . '" value="' . esc_attr( $value ) . '"' . $atts . ' />';

    d) between 'input' and 'type', add:
    onFocus="clearText(this)"

    worked fine for me, bit of a hack tho

    :)

Reply

You must log in to post.

About this Topic