I can't figure this out. It's probably something small which I can't process at the moment. I am a beginner in this, sorry.
Now I am working on this chat, every time I press enter a class is being created with username and message.
On the left side of username, I want to put this img profile which the user can chose, or just use the default.png.
I want the picture to remain on the left side of his name before deleting.
Here is some of the code:
<script>
$("#message").keypress(function(e) {
var test = $("#Uname").val()
var valmsg = $('#message').val();
var poza = $('<img src="http://dev.alurosu.com/bobo/chat/data/img/admin/default.png">');
if(e.which == 13 && valmsg.trim() == "" ){
e.preventDefault();
alert('Please type a message to send');
} else if (e.which == 13) {
$("#chat").append("<div class='mesaj' >" + test + ':' + valmsg + "</div>");
$("#chat").append(poza);
$('#message').val('');
e.preventDefault();
}
});
</script>
And here is Jsfiddle but I couldn't upload the complete code.
And here is a screenshot exemple
Hope you can explain to me somehow. Thank You.