One of my favorite WordPress themes lately is the Salient WordPress Theme by ThemeNectar. It does most things with ease and there are settings that save you quite a bit of time once you become familiar with the layout.
I have a contact form on a contact us page. Everything looks and works correctly with the form, but once I submit the form successfully and it resets the placeholders are missing. I tried several different things such as setting the placeholders again with jQuery, but when I looked in the element inspector the placeholders were there, but not displaying. The only way I could get them to show up again was by clicking into the input field then tabbing to the next one or clicking outside.
My solution was to use the jQuery blur(); function. I tried this by using on click of the submit, but ran into issues where it would reset those inputs even if it failed validation and didn’t successfully submit. So I modified it and on a successful submit it will then blur all of the fields after 1 second and the placeholders return as expected.
The easiest way to add the jQuery to your page is through the page builder, just add a Raw JS Element.
Here’s the code to place within there:
The wpcf7mailsent you will not modify, that’s the Contact Form 7 success event to listen for. You will change the field names before each blur function, you can add as many as you need.
Questions or comments? View the forum discussion here.