Writing text on “div” using JavaScript

后端 未结 10 2537
难免孤独
难免孤独 2021-01-04 02:11

I\'m having some trouble whenever I want to add some text to my div tag, here\'s my code:




10条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-04 02:36

    What's happening is your form is submitting, the page is refreshing, and the div is going back to its pre-JavaScript-set content.

    Try swapping the type='submit' to 'button' on the button.

提交回复
热议问题