Support » Plugins » Hacks » comment form

  • Hi

    I’m trying to input an initial value and clear it when clicked;

    here is the code taken from the includes comment-template.php

    'author' => '<p class="comment-form-author">' . '<label for="author">' . __( '' ) . ( $req ? ' <span class="required"></span>' : '' ) . '</label> ' .
    		            '<input id="author" name="author" type="text" size="24" /></p>',

    however if i add – onclick=”this.value=”” i get the parse error below;

    Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ‘

    Any help gratefully appreciated;

Viewing 1 replies (of 1 total)
  • Moderator bcworkz


    You are using single quotes to define a string fragment, so any single quotes that appear within the fragment need to be escaped with a backslash:
    '<input id="author" name="author" type="text" size="24" onclick="this.value=\'\';" /></p>'

Viewing 1 replies (of 1 total)
  • The topic ‘comment form’ is closed to new replies.