Skip to content

Instantly share code, notes, and snippets.

@yamatt
Created March 12, 2013 21:15
Show Gist options
  • Save yamatt/5147104 to your computer and use it in GitHub Desktop.
Save yamatt/5147104 to your computer and use it in GitHub Desktop.
A starting point for a HTML5 messaging page using WebRTC
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>HTML5 Message Tests</title>
</head>
<body>
<h1>Set a name and type a message</h1>
<form id="name">
<label>Enter your name:
<input type="text" name="name" required placeholder="Your name..." />
</label>
<button type="submit">Set</button>
</form>
<form id="message">
</form>
<ul id="messages">
</ul>
<script type="text/template">
<li><strong>{{ name }}:</strong> {{ message }}</li>
</script>
<script>
var set_name = document.querySelector("#name");
set_name.addEventListener("submit", function (e, data) {
e.preventDefault();
var name = e.srcElement.querySelector("input[name=name]").value;
this.classList.add("close");
}, true);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment