Contact Form 7 – On Click Clear Value

It is very simple to get the value cleared on Contact Form 7

Open the file:

/wp-content/plugins/contact-form-7/modules/text.php

Replace this:

$html = '<input type="text" name="' . $name . '" value="' . esc_attr( $value ) . '"' . $atts . ' />';
With this:
$html = '<input type="text" name="' . $name . '" value="' . esc_attr( $value ) . '"' . $atts . ' onfocus="if(this.value==\'';
$html = $html . esc_attr( $value ) . '\') this.value=\'\';" onblur="if(this.value==\'\') this.value=\'' . esc_attr( $value ) . '\';" />';

Then Open the file:

/wp-content/plugins/contact-form-7/modules/textarea.php

Replace this:

$html = '<textarea name="' . $name . '"' . $atts . '>' . esc_html( $value ) . '</textarea>';

With this:

$html = '<textarea name="' . $name . '"' . $atts . ' onblur="if (this.value == \'\') {this.value = \'' . esc_html( $value ) . '\';}" onfocus="if (this.value == \'' . esc_html( $value ) . '\') {this.value = \'\';}">' . esc_html( $value ) . '</textarea>';

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>


Strict Standards: call_user_func_array() expects parameter 1 to be a valid callback, non-static method dc_jqsocialtabs::footer() should not be called statically in /home/sbaseoco/public_html/wp-includes/plugin.php on line 403

Strict Standards: Non-static method dc_jqsocialtabs::get_plugin_directory() should not be called statically in /home/sbaseoco/public_html/wp-content/plugins/social-network-tabs/inc/dcwp_shortcodes.php on line 130

Strict Standards: Non-static method dc_jqsocialtabs::get_plugin_directory() should not be called statically in /home/sbaseoco/public_html/wp-content/plugins/social-network-tabs/inc/dcwp_shortcodes.php on line 137

Strict Standards: call_user_func_array() expects parameter 1 to be a valid callback, non-static method wf_php::wp_footer() should not be called statically in /home/sbaseoco/public_html/wp-includes/plugin.php on line 403
Form Login | SEO Login | About Us | Contact Us | Free E-Book | Request a Free SEO Demo| Free Website Analysis | Search Engine |Add URL to Search Engine