display:none, and show a success message.To achieve the functionality of making a section disappear and displaying a success message using JavaScript upon successful form submission in Webflow, follow these steps:
document.querySelector to target the form and the section you want to disappear.submit event on the form.success to check the submission status.display style to none to hide it and create a new element or modify an existing one to display your success message.
#section-id with your actual section's ID and .w-form-done with the class for the success message.```javascript
// Assuming you have jQuery loaded in your project
$('.your-webflow-form-class').on('submit', function() {
var form = $(this);
form.on('submit:success', function() {
$('#section-id').css('display', 'none'); // Hide section
$('.w-form-done').text('Success! Your form has been submitted properly.'); // Show success message
});
});
```
By adding a custom Embed Code component with JavaScript, you can manipulate Webflow's form submission behavior to hide a section and display a success message when the form is successfully submitted. Make sure to test on the live site as custom code runs only there.