xxxxxxxxxx
<button type="button" onclick="ClearFields();">Clear</button>
function ClearFields() {
document.getElementById("textfield1").value = "";
document.getElementById("textfield2").value = "";
}
xxxxxxxxxx
<h2 id="count-me">4</h2>
<button onclick="save()">Reset</button>
function save() {
// If what you want to reset is an integer
document.getElementById("count-me").textContent = 0;
// If what you want to reset is a textfield
document.getElementById("textfield1").value = "";
let count = 0; // If you create a count variable in Javascript
}
xxxxxxxxxx
// Function to show the cookie card after 3 seconds
function showCookieCard() {
var cookieCard = document.getElementById('cookieCard');
cookieCard.style.display = 'block';
}
// Set a timeout to call the showCookieCard function after 3 seconds
setTimeout(showCookieCard, 3000);
// Function to hide the cookie card when "Accept" is clicked
function acceptCookies() {
var cookieCard = document.getElementById('cookieCard');
cookieCard.style.display = 'none';
}
function openSuccessModal() {
document.getElementById('successModal').style.display = 'block';
document.getElementById('overlay').style.display = 'block';
}
function closeSuccessModal() {
document.getElementById('successModal').style.display = 'none';
document.getElementById('overlay').style.display = 'none';
// Clear all input fields in the form
var form = document.querySelector('.form');
form.reset();
}
document.addEventListener('DOMContentLoaded', function () {
// Add event listener to the form for submitting
document.querySelector('.form').addEventListener('submit', function (event) {
// Prevent the default form submission
event.preventDefault();
// You can perform any additional actions here
// Open the success modal
openSuccessModal();
});
// Add event listener to the "Accept" button in the cookie card
document.querySelector('.accept').addEventListener('click', function () {
// Hide the cookie card when "Accept" is clicked
acceptCookies();
});
// Add event listener to the close button in the success modal
document.querySelector('#closeModal').addEventListener('click', function () {
// Close the success modal and clear form fields
closeSuccessModal();
});
});