Skip to:

Using JavaScript to append text to the reply form.

  • vincenzon617


    Is there a way to append text to the reply form using JavaScript?
    I have this function

    window.onload=function() {
    	document.getElementById("toggle-check").addEventListener("click", funct1);
    	function funct1() {
    		if(this.checked) {
    			document.getElementById('bbp_reply_content').innerHTML = "clicked";
    		} else {
    			document.getElementById('bbp_reply_content').innerHTML = "notclicked";

    which is used when the user clicks a checkbox that I have made. I would like the text to be appended to the reply form at the end of their message, depending on whether or not they have clicked the checkbox. Currently, the .innerHTML is not working when there is text already in the reply form but it works when the reply form is empty.

    Has anyone got any ideas on how to do this? Maybe there is a text variable that stores the user’s message that I can append to – if so what is the name?

    Many thanks

Viewing 2 replies - 1 through 2 (of 2 total)

  • vincenzon617


    I have managed to find the solution! For anyone else who may have this problem, change this part of the code above:

    .innerHTML = "clicked";
    .value += "clicked";

    Robin W


    great – and thanks for posting the solution

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Skip to toolbar