bro,I'm a chinese man,when i see your problem, in this sentence '$( ".counter" ).append ("answer")' ,you should use {}
to append answer not put the string "anwser" in it.
If you want to use JQuery,there is answer for you:
$(document).ready(function() {
// 初始化计数器
let counter = 0;
// 显示计数的元素
const $counterDisplay = $('.counter');
// 点击按钮时的处理
$('.clickme').on('click', function() {
// 增加计数
counter++;
// 更新显示
$counterDisplay.text(counter);
});
});
if you want to contact with me,welcome to answser me
enter code here