diff example/persona.html @ 40:cb1d21648588

count clicks the hard way
author Jeff Hammel <jhammel@mozilla.com>
date Fri, 27 Dec 2013 20:13:04 -0800
parents 6b5946843928
children d4522af2c6e5
line wrap: on
line diff
--- a/example/persona.html	Fri Dec 27 20:02:00 2013 -0800
+++ b/example/persona.html	Fri Dec 27 20:13:04 2013 -0800
@@ -10,6 +10,8 @@
 <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
 <script src="https://login.persona.org/include.js"></script>
 <script>
+var nclicks = 0;
+
 $(document).ready(function() {
 
 var currentUser = null;
@@ -47,7 +49,10 @@
 
 var signinLink = document.getElementById('signin');
 if (signinLink) {
-signinLink.onclick = function() { navigator.id.request(); };
+signinLink.onclick = function() { navigator.id.request();
+nclicks += 1;
+$('clickcounter').append('<li>This is click ' + nclicks + '</li>');
+};
 }
 
 var signoutLink = document.getElementById('signout');
@@ -69,6 +74,9 @@
   <a id="signin">sign in</a>
 </div>
 
+<ul id="clickcounter">
+</ul>
+
 <h2>Resources</h2>
 <ul>
   <li>