im working on dynamic jsp. when a user clicks on submit button for first time, it should ask do you want to fill the form, When he clicks yes, form should be displayed after filling form, and clicking on submit button for the second time form should be submitted
CodePudding user response:
Here is the basic example I can show to you. Show us what you got until now to can help you.
function toggleVisibility() {
var e = document.getElementById("yourForm");
e.style.display = ((e.style.display!='none') ? 'none' : 'block');
}
const toggleBtn = document.getElementById("toggleBtn");
toggleBtn.addEventListener("click", toggleVisibility);
<a href="#" id="toggleBtn">Click here to toggle visibility of form</a>
<div id="yourForm" style="display: none">Your form will be here</div>
CodePudding user response:
you can take variables and initialize with 0 and increment on 1st click. compare with 0 to display dialog and 1 for form submission. if you provide code may be I can demostrate.
