Since your question doesnt include any code. This answer has to stay basic.
If your using JavaScript there many ways you could watch if the users typing:
For example if the user is focused on the input box and there is a key down event then send an ajax message saying "USER ID TYPING" then the server can handle that.
I think this is a similar question: "User is typing" function in chat
Please give some code so we are able to help!
-PLEASE ALSO NOTE-
Your implementation depends on what server side platform your using and how you want to interact.
I've done something similar in PHP where every 10 seconds i would see if there's a change if there i would send a AJAX request to PHP then update the clients that need to know that information
And for the message hiding or showing you can use:
JavaScript to change the visibility of the span that contains the message.
If you use jQuery then its $('#spanID').hide()
or $('#spanID').show()