Thasmo
public javascript v1 · immutablefunction sendMessage() { // resetting the index index = -1; if($("#input_message").val() != "") { // adding the item to the array chat_history.unshift($("#input_message").val()); // limiting the array if(chat_history.length - 1 == limit) { chat_history.pop(); } $("#input_form").submit(); $("#input_form").reset(); $("#input_message").attr('value', ""); $("#input_message").val(""); return false; }}