Jquery .val() for input only works once
<p>I'm trying to create a chat box for my game.</p>

<p>The user type's their chat into the input:text feild and by ither pressing Enter or clicking the button submits the chat text.</p>

<p>This all works, however for some reason after the first time a user submits a chat message it fails to get the text from the input field.</p>

<p>Here is my code.</p>

<pre><code>$(document).ready(function() {
 $("#chatEnter").live('click',function(){
  var chat = $('#chatText').val();
  sendChat(chat);
 });
});

$(document).ready(function() {
 $("#chatText").keypress(function(e){
  if ((e.which &amp;&amp; e.which == 13) || (e.keyCode &amp;&amp; e.keyCode == 13))
  {  
   var chat = $('#chatText').val();
   sendChat(chat);
   return false;
  }
  else return true;   
 });
});

function sendChat(chat)
{ 
 alert(chat); //temp test alert
 $.getJSON("includes/boardUpdate.php",{chat: chat, bid: bid});
 $('#chatText').val("");
}
</code></pre>

<p>It doesn't matter if i first submit a text by clicking the button or pressing enter, all future attempts submit blank entrys until I refresh the page.</p>

<p>Edit: I've tried it with and without the line to clear the text box, same results both ways.</p>

<p>Your help is appreciated. </p>
