79150045

Date: 2024-11-02 05:54:51
Score: 0.5
Natty:
Report link

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
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Unregistered user (0.5):
  • Low reputation (1):
Posted by: A_CHN_MAN