Skip to content

Instantly share code, notes, and snippets.

@kirandash
Created April 12, 2017 10:24
Show Gist options
  • Select an option

  • Save kirandash/b412d3d487f7fdcc7ff51e796fb2d546 to your computer and use it in GitHub Desktop.

Select an option

Save kirandash/b412d3d487f7fdcc7ff51e796fb2d546 to your computer and use it in GitHub Desktop.
Gravity form post AJAX submission jquery call
jQuery(document).bind('gform_post_render', function(){
// code to trigger on AJAX form render
$('select').fancySelect();
formResize();
$(window).on('resize', formResize);
$(window).on('load',formResize);
$('select').on('change', formResize);
$('.fancy-select .options li').on('click', formResize);
/********************************
* Custom check box *
********************************/
$.each($('input[type="checkbox"]'), function() {
var name = $(this).attr('id') || $(this).attr('name');
$(this).after('<span class="custom-checkbox" for="'+ name +'"></span>');
});
/********************************
* Custom scroll textarea *
********************************/
$("textarea").niceScroll({
autohidemode: false,
cursorcolor: "#e5e6e7",
cursorwidth: "6px",
railoffset: "5px"
});
/**************************************
* VALIDATION ERROR CUSTOM POSITION *
**************************************/
var errorHtml = jQuery('.validation_error').html();
if(jQuery('#contact-form .gform_wrapper').hasClass('gform_validation_error')){
jQuery('#contact-form .validation_error').remove();
jQuery('#contact-form .gform_footer').append('<div class="validation_error"><span>'+errorHtml+'</span></div>');
}else {
jQuery('.validation_error').css('display', 'none');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment