How to show hidden div after hitting submit button in form?

前端 未结 3 1956
野的像风
野的像风 2021-01-21 11:53

I have simple HTML form with submit button. After hitting this button I would like to the see div#my_id which is not visible before.



        
3条回答
  •  北荒
    北荒 (楼主)
    2021-01-21 12:35

    Is your HTML contained within the

    tag? It is likely that your submit button is submitting the form and causing a page refresh before the JavaScript is executed.

    If this is the case, try changing the input type to button to see the effect.

    For example:

    #my_id {
        display: none;
    }
    
        
        
    My text

提交回复
热议问题