I think the only way is to build a ‘wysiwyg’, which is a fairly complex task. You will need a div instead of a text area in order to visually represent the HTML contents
Actually, on this site the emoji doesn’t show in the textarea but in the preview panel to the right. To do that, you can parse the textarea value on input using regular expressions, and update the HTML of your preview element accordingly:
var input = document.querySelector('.input')
var preview = document.querySelector('.preview')
input.addEventListener('input', function onInput () {
var text = this
.value
.replace(/\:\)/g, '<img src="http://pix.iemoji.com/images/emoji/apple/ios-9/256/slightly-smiling-face.png">')
.replace(/\:D/g, '<img src="http://pix.iemoji.com/images/emoji/apple/ios-9/256/grinning-face.png">')
// chain more replacements here
preview.innerHTML = text
})
If you want a “real” WYSIWYG you can also hide the textarea so that it appears as if the user was typing directly in the preview element; however, this is quite a bit more involved as you’ll have to display a cursor, handle selections etc.
Ah okay… well no, you’ll always the the img tags written out then. You might just add them later instead when the comment gets written to the database, like, without any JS.