$(document).ready(function(){ $('[data-toggle="tooltip"]').tooltip({container: 'body'}); }); $("form").submit(function(event) { var recaptcha = $("#g-recaptcha-response").val(); if (recaptcha === "") { event.preventDefault(); alert("Please check the recaptcha"); } });