How to insert a nickname into a chat?

  • 0
    There is a small chat, output through a frame, you need help to add the onclick function, that is, if you need to answer a person and, for example, to enter his name from the output in the textarea, there is such a function.
    Like this.

    <a href=# onclick=\"enter_user('[b #]".$name."[/b] ')\"><b>".$name."</b></a>

    her code
    function enter_user(n)
        parent.document.getElementById('chat').innerHTML=n+', ';

    but it works once, that is, pressed someone answered, and if someone answers again, do not enter the area into the text, but the page needs to be reloaded how to deal with it
    JavaScript Anonymous, Aug 17, 2020

  • 0 Answers
Your Answer
To place the code, please use CodePen or similar tool. Thanks you!