How to clear all input fields in bootstrap modal when clicking data-dismiss button?

后端 未结 10 872
情话喂你
情话喂你 2020-12-04 10:58

How to clear all input fields in a Bootstrap V3 modal when clicking the data-dismiss button?

10条回答
  •  余生分开走
    2020-12-04 11:35

    Put the contents in your modal inside a form and give it an ID which is equal to "myForm".

    When the close button is clicked, give an onclick to the function "myFunction()".

    
    
    function myFunction() {
                document.getElementById("myForm").reset();
            }
    

提交回复
热议问题