Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3

Thread: JS Error

  1. #1
    Regular Coder
    Join Date
    Feb 2005
    Posts
    203
    Thanks
    6
    Thanked 0 Times in 0 Posts

    JS Error

    Hello, I'm getting the following error...

    [Error] TypeError: 'undefined' is not a function (evaluating '$("button[rel]").overlay({top:"30%",mask:{color:"#fab515",loadSpeed:250,opacity:.6},closeOnClick:true,load:true})' )

    on the following chunk of JS... (it's towards the bottom) ... wondering what I'm missing here.


    Code:
    // contact form
    function contactForm() {
      jQuery('form#contactForm').bind('submit', function(event){
      var hasError = false;
      var errorCheck = false;
      var errorMsg = '';
      $('.info').remove();
      $('li').removeClass('error');
      if (errorCheck == false) {
        errorMsg = '';    
        $('.requiredField').each(function() {
      		if(jQuery.trim($(this).val()) == '') {
      		    $(this).closest('li').addClass('error');
    
      		    var labelText = $(this).attr("name");
            if (labelText == 'cname') {labelText = 'name';}  			  
            errorMsg += '<li>Forgot to fill in your '+labelText+'</li>';
      
      			hasError = true;
      		} else if($(this).hasClass('email')) {
      			var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
      			if(!emailReg.test(jQuery.trim($(this).val()))) {
      				$(this).closest('li').addClass('error');  					
      				errorMsg += '<li>Forgot to fill in your email</li>';
      				hasError = true;
      			}
      		}
      	});
      	
        //display errors
      	var errorHtml = '<div class="info"><h3>Error</h3><ul>';
        errorHtml += errorMsg;  		           
        errorHtml += '</ul></div>';
        $('.text-area h2').after(errorHtml);
      }
      
      // overlay attributes
      if(hasError == false) {
      	var formInput = $(this).serialize();
      	$.post($(this).attr('action'),formInput, function(data){
          // load thank you overlay
          $("button[rel]").overlay({
            top:'30%',
            mask: {
              color: '#fab515',
              loadSpeed: 250,
              opacity: 0.6
            },
            closeOnClick: true,
            load: true
          });
          $('.info').remove();	  
      	});
      }
      
      return false;		
      });
    }

  • #2
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,859
    Thanks
    6
    Thanked 1,028 Times in 1,001 Posts
    That’s a weird message (I would expect it to say “‘overlay’ is not a function”) but I suspect that the overlay plugin code is missing (not yet parsed?) when the overlay function is called.

  • #3
    Regular Coder
    Join Date
    Feb 2005
    Posts
    203
    Thanks
    6
    Thanked 0 Times in 0 Posts
    hmmm.... i checked and the plugin code is being called separately in the src 1 line up from this script.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •