Can I have two JavaScript onclick events in one element?

后端 未结 5 618
南旧
南旧 2020-12-13 10:00

Can we put two JavaScript onclick events in one input type button tag? To call two different functions?

5条回答
  •  被撕碎了的回忆
    2020-12-13 11:03

    There is no need to have two functions within one element, you need just one that calls the other two!

    HTML

    click
    

    JavaScript

    function my_func() {
        my_func_1();
        my_func_2();
    }
    

提交回复
热议问题