<html>
<body>
Counter: <input type="button" value="1" data-counter><br>
One more counter: <input type="button" value="2" data-counter>
<script>
document.addEventListener('click', function(event) {
if (event.target.dataset.counter != undefined){
//if THE ATTRIBUTE 'COUNTER' exists...
event.target.value++;
}
});
</script>
</body>
</html>
<body>
Counter: <input type="button" value="1" data-counter><br>
One more counter: <input type="button" value="2" data-counter>
<script>
document.addEventListener('click', function(event) {
if (event.target.dataset.counter != undefined){
//if THE ATTRIBUTE 'COUNTER' exists...
event.target.value++;
}
});
</script>
</body>
</html>
/*this small little so funny thing ㅠㅠㅠㅠ so cute and funny*/
댓글
댓글 쓰기