I tried adding smilies by using
happy = new Image();
happy.src = "../images/smiley2.png";
var text = $('#chatText').val();
but, that didn't work. Any help would be greatly appreciated.