ruslite,
flag = true; надо вынести за submit
<!DOCTYPE HTML>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
<script src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<body>
<div class="example">
<form class="form-inline" id="messageForm">
<input id="nameInput" type="hidden" class="input-medium" value="<?php echo $log_username;?>" />
<input id="canalInput" type="hidden" class="input-medium" value="<?php echo $name;?>" />
<div id="messageInput" name="messageInput1" placeHolder="Ваше сообщение">12345</div>
<input type="submit" value="Отправить" onclick="$('.emoji-wysiwyg-editor').html('')"/>
</form>
</div>
<script>
flag = true;
$( "#messageForm" ).submit( function() {
var nameVal = $("#nameInput").val();
msg = $("#messageInput").html();
var canalVal = $("#canalInput").val();
if (nameVal && msg && flag) {
flag = false;
window.setTimeout(function () {
flag = true
}, 3000) ;
alert("форма отправлена");
}
else {alert("ждите отстоя пены")};
return false;
});
</script>
</body>
</html>