Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

50 lines (34 sloc) 0.815 kb
<!doctype html>
<head>
<!-- jquery -->
<script src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
<!-- Socket.io -->
<script src="/socket.io/socket.io.js"></script>
<script>
var socket = io.connect('http://localhost');
socket.on('news', function (data) {
console.log(data);
});
</script>
<!-- Text Input -->
<script>
$(document).ready(function() {
$('#story').keyup(function(event)
{
var txtInput = $(this).val();
//capture sentence on enter key
if (event.which == 13) {
console.log(txtInput);
socket.emit('slog', { my: txtInput });
txtInput = ''; // empty buffer
}
});
});
</script>
</head>
<body>
<textarea rows="15" cols="50" id="story">
</textarea>
<div id="test"></div>
</body>
</html>
Jump to Line
Something went wrong with that request. Please try again.