3 ms·
You could simplify this <script> var counter = 0; $(document).ready(function() { var $output = $('#output'); $('#increment').click(func
by nicolasMLV 10y ago
You could simplify this
<script>
var counter = 0;
$(document).ready(function() {
var $output = $('#output');
$('#increment').click(function() {
counter++;
$output.html(counter);
});
$output.html(counter);
});
</script>
with
<script>
var counter = 0;
$(document).on('click', '#increment', function() {
counter++;
$('#output').html(counter);
});
</script>
- deleted 10y ago[deleted]