Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

33 lines (26 sloc) 0.792 kB
<h2>Chat Window</h2>
<div id="messages"></div>
<div style="position: absolute; bottom: 25;">
<input type="text" id="text-input">
<input type="button" value="Send" id="send-button">
</div>
<script>
$(document).ready(function(){
now.receiveMessage = function(name, message){
$("#messages").append("<br>" + name + ": " + message);
}
$("#send-button").click(function(){
now.distributeMessage($("#text-input").val());
$("#text-input").val("");
$("#text-input").focus();
});
$("#text-input").keypress(function (e) {
if (e.which && e.which === 13) {
$("#send-button").click();
return false;
}
});
now.name = prompt("What's your name?", "");
$("#text-input").focus();
});
</script>
Jump to Line
Something went wrong with that request. Please try again.