Open dsiah opened 9 years ago
I was having this issue too. Then realized I just needed to move script tags to the bottom, right before </body>
. After doing that, the original chat example code works fine.
just write $(document).ready(function () { $('form').submit(function(){ socket.emit('chat message', $('#m').val()); $('#m').val(''); return false; }); }) where we adding document ready function... now we can put script in head) hope helps)
Hi, I was programming the index.html page and I ran across an error where the return false in the
$('form').submit(callback)
did not actually stop the callback seen in this block:For anyone else hitting this problem I remedied it by creating a helper method and attaching it to the button. Instead of using a form element I wrapped the "form" in a div element. the code below is what worked for me to complete the example: