javascript - Update Time when user clicks buttons -
apparently don't understand .val() well. i'm trying have buttons user can click them , input number of hours read. can't basic buttons work. if can working won't too hard make 4th click of quarter hour button roll-over appropriately. here's code, maybe can tell me dumb thing i'm doing:
html:
time (h:mm): <span id="hoursread">0</span>:<span id="minutesread">00</span><br> <button id="fifteen">+15 minutes</button> <button id="sixty">+1 hour</button> <button id="minus">-1 hour</button>
jquery:
$('#sixty').click(function () { $('#hoursread').val(+1); }); $('#fifteen').click(function () { $('#minutesread').val(+15); }); $('#minus').click(function () { $('#hoursread').val(-1); });
i've been fiddling no avail!
you need use text()
insead of val()
span
having id hoursread
, val() used input elements. although have calculate time interval.
Comments
Post a Comment