I have a page that displays data. A user can click "edit" button and the text displays within a form. Basically I hide form and on click toggle text to hide and form to show. I need to make sure that the form can not be submitted, via page refresh or clicking Enter key, until it is visible and the user clicks submit button.
How do I do that?
$("#dataForm").hide(); $("#editData").click(function() { $("#dataForm").toggle(); $("#dataText").toggle(); }); <div id="dataForm"> <label>Label 1</label> <input type="text"> <label>Label 2</label> <input type="text"> <input type="submit"> </div> <div id="dataText"> Label 1: abc <br> Label 2: 123 <br> <span id="editData">Edit</span> </div>