jquery html disappears on click event

前端 未结 2 484
春和景丽
春和景丽 2021-01-20 00:44

Please see the following code:


2条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-20 01:28

    in order to prevent the form from posting, so that you can see your changes, you need to call preventDefault()

    $('#helloButton').click(function (e) {
        e.preventDefault();
        $('#hello').html('
    hello world
    '); });

提交回复
热议问题