Error Message on Event Expiration
Hi,
I was trying this solution available in the community already to display an error message and hide the form on my Landing Page once the event is over:
<!DOCTYPE html>
<html>
<head>
<style>
.formHolder{
display: block;
}
</style>
</head>
<script language="JavaScript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
<script>
MktoForms2.whenReady(function(form) {
var today = new Date(); //set the current date
var registrationClose = Date.parse("{{my.WBNExpirationDate}}"); //change to your desired date
if (today > registrationClose) {
$(".mktoForm").wrap( "<div class='formHolder'></div>" );
$(".mktoForm").hide();
$(".formHolder").append('<div><p>{{my.ErrorMessage}}</p></div>'); //change to your desired content here, set appropriate classes/IDs for styling
};
});
</script>
</html>
However, my error message is displayed twice. Perhaps, I am not setting the div class correctly.
Can someone check my code & give me some inputs.
Kind Regards!