Instead of calling the function inside the onclick property just assign the name of the function to the onclick property onclick="submitFunction"✅ onclick="submitFunction()"❌