PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Custom jQuery working for validation error but not confirmation

  1. iasr
    Member

    Hi Guys.

    I am trying to add a couple of classes to the '.gform_confirmation_message_X' elements and am having no luck. However, the following code is successful in adding those classes to the '.validation_message element'.

    The Code:

    function gformsError() {
    
    		jQuery(document).bind('gform_post_render', function(){
    
       			$('#input_2_1').attr('placeholder','Name...');
    	    	$('#input_2_3').attr('placeholder','Email...');
    	    	$('#input_2_5').attr('placeholder','Phone...');
    	    	$('#input_2_2').attr('placeholder','Subject...');
    	    	$('#input_2_6').attr('placeholder','Your Company\'s Goals...');
    
    	    	$('#input_4_1').attr('placeholder','Name...');
    	    	$('#input_4_3').attr('placeholder','Email...');
    	    	$('#input_4_5').attr('placeholder','Phone...');
    	    	$('#input_4_2').attr('placeholder','Subject...');
    	    	$('#input_4_6').attr('placeholder','Your Company\'s Goals...');
    
    	    	$('[placeholder]').focus(function() {
    			  var input = $(this);
    			  if (input.val() == input.attr('placeholder')) {
    			    input.val('');
    			    input.removeClass('placeholder');
    			  }
    			}).blur(function() {
    			  var input = $(this);
    			  if (input.val() == '' || input.val() == input.attr('placeholder')) {
    			    input.addClass('placeholder');
    			    input.val(input.attr('placeholder'));
    			  }
    			}).blur().parents('form').submit(function() {
    			  $(this).find('[placeholder]').each(function() {
    			    var input = $(this);
    			    if (input.val() == input.attr('placeholder')) {
    			      input.val('');
    			    }
    			  })
    			});
    
    			$('.gfield_description.validation_message').addClass('animated fadeIn');
    			$('.gform_confirmation_message_3').addClass('animated fadeIn');
    			$('.gform_confirmation_message_2').addClass('animated fadeIn');
    
    		});
    	}

    A demo: http://dppad.com/dev/3/

    Posted 6 years ago on Tuesday April 30, 2013 | Permalink