// Assuming this is part of a jQuery form submission handler if (someValidationFails) { // Create an error message paragraph dynamically var newParagraph = $('

Please enter a valid email.

'); // Append the error message after the specific email input error container $('#error_for_' + email_id).after(newParagraph); // Prevent form submission event.preventDefault(); } else { console.log('line26'); // Debug line to indicate success or next step } // Optionally remove the line below if already handled above // event.preventDefault(); // Commented out — only needed if you always want to prevent submission