I want to set time value from javascript when tr table clicked, but it's just work on first row. then if i try to alert (not set value) its working idk whats the problem, here is my code :
Note : table code is to long so i cannot share but table id is example_table
I hope time value can be set every click any table row
$(document).ready(function() {
$("#example_table").delegate("tr", "click", function() {
var d = new Date(),
h = (d.getHours() < 10 ? '0' : '') + d.getHours(),
m = (d.getMinutes() < 10 ? '0' : '') + d.getMinutes();
now = h + ':' + m;
$("#start").val(now);
});
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
<input type="time" name="start" class="form-control form-control-border" id="start">