I am just learning JavaScript/jQuery today, and I am having trouble with a stopwatch I am trying to make. Here is my code:
$(document).ready(function () {
var value = 0.0;
$("#STARTSTOP").click(function () {
$(this).css("value", "Stop");
while (true) {
value += 0.1;
$("#TIME").delay(100).html(value);
$(this).click(function () {
$(this).css("Value", "Start");
break;
});
}
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
<!DOCTYPE html>
<html>
<head>
<title>JQuery Testing Facilities</title>
</head>
<body>
<input id="STARTSTOP" type="button" value="Start"></input>
<br>
<p id="TIME">0.0</p>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="onLoad.js"></script>
</body>
</html>
The problem I am having is that it doesn't start, the value of my button doesn't change. I tried doing it with out the second onClick function, but then I have no way of stopping it, and the browser lags out.