Created
March 31, 2016 14:05
-
-
Save SalvadorP/d5b0a0008a80b491855bdb852df66a75 to your computer and use it in GitHub Desktop.
JS Periodic Button Clickr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang=""> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>CLICK TEST</title> | |
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous"> | |
</head> | |
<body> | |
<div class="container-fluid"> | |
<div class="row"> | |
<div class="col-sm-offset-5 col-sm-2"> | |
<button type="button" class="btn btn-primary" id="click">CLICK ME!</button> | |
</div> | |
<div class="col-sm-2"> | |
<div class="well well-lg"><span id="times">0</span></div> | |
</div> | |
</div> | |
</div> | |
<!-- SCRIPTS --> | |
<script src="https://code.jquery.com/jquery-1.12.2.min.js" crossorigin="anonymous"></script> | |
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script> | |
<script> | |
var clicks = 0; | |
function clicker() { | |
console.log("click!"); | |
clicks++; | |
$('#times').html(clicks); | |
} | |
$(document).ready(function(){ | |
setInterval(clicker, 2500); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment