How to trigger a page and question error message in Java script – to block gmail hotmail yahoo in email question



I have an email question type and am looking to block people from entering free email addresses.

I have a javascript question with the code below (which works using the alert) but i can’t figure out how to trigger the gizmo page and question error messages. Looking at different posts the only code i could find but does not work is:


Any one know how to do this?

My code is below:



var tgtbox = $(‘#sgE-4633617-1-473-element’).val();
var $errortxt = ‘Please enter a email address to continue.’;

if(tgtbox.includes(“gmail”)) {

//alert($errortxt); //correctly shows error txt when active

//this does not work

e.preventDefault(); //functions correctly stops page progressing


}); //end submit validation


Craig Bain asked


    Question stats

    • Active
    • Views1103 times
    • Answers0 answers
    • Followers2 followers