Tell me more ×
WordPress Answers is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

In my intranet with WP I need to put a butoon near comment form to insert tipical text comment. Example: button to insert "This task is finished" I try this:

<input type="button" value="Hola" onClick="document.commentform.comment.value += 'hola';">
share|improve this question
Voting to close. This question is off topic. – Brady Feb 15 '12 at 15:15

closed as off topic by kaiser, Chip Bennett, Brady, EAMann Feb 15 '12 at 22:03

Questions on WordPress Answers are expected to relate to WordPress within the scope defined in the FAQ. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about closed questions here.

1 Answer

Is that working for you? Please clarify your question. I would rewrite the code as such:

<input type="button" value="Hola" onclick="document.getElementById("comment").value += 'hola';">

Try that and see if it works. Note the lowercase "C" and the use of DOM-based methods.

By the way, this thread in specific to WordPress and probably belongs on StackOverflow.

share|improve this answer
Joseph I tried this code but don´t work – Fontepink Feb 15 '12 at 14:37
this is the correct code. Thanks Joseph <input type="button" value="Hola" onClick="document.getElementById('comment').value += 'hola';"> – Fontepink Feb 15 '12 at 14:50

Not the answer you're looking for? Browse other questions tagged or ask your own question.