Fix Missing Placeholder Text in Gravity Forms after Ajax post

WordPress
Fix Missing Placeholder Text in Gravity Forms after Ajax post

Occasionally in our series of articles, we want to address some tips to resolve some type of issues which may occur in Gravity forms. We were working on a project last day and we had a problem with the Placeholder text in the gravity form. Placeholders were missing in the gravity form after Ajax post. Surprisingly, this fix is not built-in to Gravity Forms (Yet). However we can insert them even after submitting the form by ajax using javascript.

You can use these codes to avoid these kind of issues.

//Setting placeholder before form submit/ page load..

jQuery(document).ready(function(){

    jQuery('#input_1_1').attr('placeholder', 'First Name');

});

Or we can use Gravity Forms – Placeholders add-on to set the labels as placeholder.

//Set placeholder after submit the form.

jQuery(document).bind('gform_post_render', function(){

    jQuery('#input_1_1').attr('placeholder', 'First Name');



});

Leave a Reply

Your email address will not be published. Required fields are marked *

5 + eleven =

2hats Logic HelpBot