1

I worked on JS function to auto populate name of the skill field of contact form 7 with the page name. It is working correct when i am deactivating w3 total cache but it not working when w3 total cache reinstall and activate. My code is below.

jQuery(document).ready(function() {
    jQuery('#cstapply').val(jQuery(this).find(".auto-titles h2").text());
});
Zac Anger
  • 6,983
  • 2
  • 15
  • 42
Aman Gupta
  • 23
  • 3
  • The code is fine (though here in 2022, there's no need for jQuery's `ready`, just use modules or `defer`; and `jQuery(this).find(/*...*/)` could just be `jQuery(/*...*/)`, since `this` is `document` in your callback). If it doesn't work with you have the W3 Total Cache enabled, then: 1. That is preventing your code running at all, or 2. It's moving or removing the elements/contents you're looking for. The only way to find out which is to [debug](https://stackoverflow.com/questions/25385173/) it. More about debugging [here](https://ericlippert.com/2014/03/05/how-to-debug-small-programs/). – T.J. Crowder Dec 02 '22 at 07:13
  • can you please elaborate by writing code once – Aman Gupta Dec 02 '22 at 07:37
  • Tried this but there is no improvement – Aman Gupta Dec 02 '22 at 10:44

0 Answers0