Skip to content

Instantly share code, notes, and snippets.

@calderonroberto
Created June 7, 2015 06:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save calderonroberto/b3d4dade3aaae83a7383 to your computer and use it in GitHub Desktop.
Save calderonroberto/b3d4dade3aaae83a7383 to your computer and use it in GitHub Desktop.
Example RED Application.
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<title>Chat</title>
<script type="text/javascript" src="jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="jquery.thingbroker-0.3.0.min.js"></script>
<style type="text/css">
p {color:gray;font-size:16px; font-style:bold; width:100px; height:100px; background-color:#E9E74A; float:left; margin-left:5px; margin-top:5px;padding:4px}
</style>
</head>
<body>
<input type="text" id="txtbox" />
<div id="chat"><p>Welcome to the discussion app.</p></div>
<script type="text/javascript">
$("#chat").thing({listen:true});
$("#txtbox").keypress(function(e){
if (e.which == 13) {
$(this).thing({prepend:"<p>"+$(this).val()+"</p>", to: 'chat'});
$(this).val("");
}
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment