JQuery in Wordpress update WPFORMs

113 Views Asked by At

I am building a website in Wordpress and I'm trying to have a form populate data based on a button press. I am using the headers and footers plugin and can validate the "script" is loading on the page. However nothing seems to happen and I don't know where to begin.

I am using the Headers and Footers Plugin to add the Script. I am using WPFORM,I have setup the classes Just mildly lost now

Button has the class Custom. WPFORM Field has the Class CompanyName

<script>
jQuery(document).ready(function() {
  // Button click event
  jQuery('#Custom').click(function() {
    jQuery('#CompanyName').val('Hello');
  });
});
</script>

Script on the Page 1

1

There are 1 best solutions below

0
On

I managed to fix this by changing the Jquery I added the "Click" to validate the Jquery was loading correctly which will display in the developer tab under console

<script>
jQuery(document).ready(function() {
  // Button click event
  jQuery('.custom').click(function() {
    jQuery('#wpforms-2453-field_2').val('Hello');
  });
});
</script>