Forums

Comment form, clear values on click (1 post)

  1. afs35mm
    Member
    Posted 1 year ago #

    So I put my comment field names in the actual field for design purposes. However I am trying to have it clear the template text of 'name' 'email' etc... when the field is clicked in. Whatever JS I seem to put in the input tags breaks the entire page, and nothing loads.

    My current input fields, in comment-template.php looks like:

    'email'  => '<p class="comment-form-email"><label for="email">' . __( '' ) . '</label> ' . ( $req ? '<span class="required"></span>' : '' ) .
    		            '<input id="box" name="email" type="text" value="Email*' . esc_attr(  $commenter['comment_author_email'] ) . '" size="30"' . $aria_req . ' /></p>',

    and when I put in the JS to look like:

    'email'  => '<p class="comment-form-email"><label for="email">' . __( '' ) . '</label> ' . ( $req ? '<span class="required"></span>' : '' ) .
    		            '<input id="box" name="email" type="text" value="Email*' . esc_attr(  $commenter['comment_author_email'] ) . '" size="30"' . $aria_req . '  onblur="if(this.value == '') { this.value='Email*'}" onfocus="if (this.value == 'Email*') {this.value=''}" /></p>',

    the page doesnt work... Any help would be greatly appreciated.

Topic Closed

This topic has been closed to new replies.

About this Topic