"disable button"
Bootstrap 3.2.0 Snippet by escapedlion

<link href="//netdna.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//netdna.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script> <script src="//code.jquery.com/jquery-1.11.1.min.js"></script> <!------ Include the above in your HEAD tag ----------> <div class="container"> <div class="row"> <a class="btn btn-default btn-lg disabled" id="up1btn">Purchase: C100</a> <BR></BR> <button onclick="btnClick()">Test</button> <BR></BR> <div id="timesClicked">000</div> </div> </div>
.container {margin-top: 25px;} .disabled { color: red; } #timesClicked { outline: 1px solid red; width: 40px; height: 25px; }
var timesClicked = 0; //main click variable var CPC = 5; var up1cost = 100; //cost for upgrade 1 function btnClick() { timesClicked = timesClicked + CPC; //increases clicks by 1 $("#timesClicked").html(timesClicked) //parses over via jquery if(timesClicked <= up1cost) { $("#up1btn").addClass("disabled") } else { $("#up1btn").removeClass("disabled") } return true; }

Related: See More


Questions / Comments: