How do I add something to my html using javascript without erasing the whole page

前端 未结 3 1785
北恋
北恋 2020-12-02 02:45

I have a small calculator that I\'m adding to my html. It has a few dropdowns to select stuff and when a person hits a submit button, I\'d like to display a picture below th

3条回答
  •  囚心锁ツ
    2020-12-02 03:18

    You need a placeholder element for your output. Then set the innerHTML for that element:

    then:

    document.getElementById('answer').innerHTML = "answer is:" + yourdata
    

提交回复
热议问题