Name it: index.html and place it in the root of your project directory
Name it: style.css and place it in res/css/ directory
Add style.css to index.html by adding this tag to head:
<link rel="stylesheet" href="res/css/style.css">
Name it: script.js and place it in res/js/ directory
Add script.js to index.html by adding this tag to head tag:
<script type="text/javascript" src="res/js/script.js">
Add code below to head tag in index.html:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
Add code below to body tag in index.html:
<div>
<div>Clicked <span id="counter">0</span> times!</div>
<button class="button" data-value="1">Increase By 1</button>
<button class="button" data-value="3">Increase By 3</button>
<button id="reset">Reset</button>
</div>
Add code below to script.js:
let counter = 0;
$(function () {
let counterTag = $('#counter');
$('.button').click(function () {
let value = $(this).attr('data-value');
counter += Number.parseInt(value);
counterTag.text(counter);
});
$('#reset').click(function () {
counter = 0;
counterTag.text(counter);
});
});