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

0

Hi,

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:

$(‘.sg-error-message’).text($errortxt).fadeIn(‘slow’);

Any one know how to do this?

My code is below:

/////

$(‘.sg-survey-form’).submit(function(e){

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
$(‘.sg-error-message’).text($errortxt).fadeIn(‘slow’);

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

}

}); //end submit validation

/////////

Craig Bain asked
    ×

    Login

    Question stats

    • Active
    • Views57 times
    • Answers0 answers
    • Followers2 followers