I\'m learning javascript and I decided to create simple Rock, Paper, Scissors game. I want to make it controllable by buttons. So I made this in html:
Maybe try this.. cleaner markup.. uses jQuery
Rock Paper Scissors DEBUG $(document).ready(function() { var user = "none"; $(".user").click(function() { user = $(this).attr("data-name"); }); $("#test").click(function() { alert(user); }); });
http://jsfiddle.net/rQDbe/