Title: Can&#8217;t target form with JavaScript
Last modified: June 26, 2022

---

# Can’t target form with JavaScript

 *  Resolved [Richard](https://wordpress.org/support/users/richardelovia/)
 * (@richardelovia)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/cant-target-form-with-javascript/)
 * Hi,
 * I’m using Forminator to create some easy booking forms. In order to make them
   more user friendly I’ve created some CSS classes that applies to elements when
   selected or changed. I’ll make an example:
 * I have a 2 option radio button and styled it as a toggle where the selected option
   is highlighted. When user selects second options the toggle slides to right highlighting
   the selected option.
 * In order to achieve this I have to assign CSS classes by jQuery but it seems 
   that nothing happens.
    When using `change()` function to check if radio changed,
   or even the `click()` function, nothing happens. Tried different ways but seems
   like js/jQuery can’t even target the form elements.

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Support [Patrick – WPMU DEV Support](https://wordpress.org/support/users/wpmudevsupport12/)
 * (@wpmudevsupport12)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/cant-target-form-with-javascript/#post-15772129)
 * Hi [@richardelovia](https://wordpress.org/support/users/richardelovia/)
 * I hope you are doing well.
 * Can you please let us know if you are using the Forminator > Form > Behaviour
   > Ajax Rendering?
 * If so, this is why this is happening, the regular JS would run before the Ajax
   render the form, but then you could use after.load.forminator event.
 * This is a small example:
 * [https://gist.github.com/patrickfreitasdev/349097cb9dadcc63d29c591cd00f5c63](https://gist.github.com/patrickfreitasdev/349097cb9dadcc63d29c591cd00f5c63)
 * Best Regards
    Patrick Freitas
 *  Thread Starter [Richard](https://wordpress.org/support/users/richardelovia/)
 * (@richardelovia)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/cant-target-form-with-javascript/#post-15772250)
 * Wow [@wpmudevsupport12](https://wordpress.org/support/users/wpmudevsupport12/)!
 * Thank you very much that works perfectly. I took a look at behavior settings 
   and AJAX was enabled. Thanks again for helping me Patrick.
 * Best regards

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Can’t target form with JavaScript’ is closed to new replies.

 * ![](https://ps.w.org/forminator/assets/icon-256x256.gif?rev=3443182)
 * [Forminator Forms – Contact Form, Payment Form & Custom Form Builder](https://wordpress.org/plugins/forminator/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/forminator/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/forminator/)
 * [Active Topics](https://wordpress.org/support/plugin/forminator/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/forminator/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/forminator/reviews/)

## Tags

 * [form](https://wordpress.org/support/topic-tag/form/)
 * [javascript](https://wordpress.org/support/topic-tag/javascript/)
 * [jquery](https://wordpress.org/support/topic-tag/jquery/)

 * 2 replies
 * 2 participants
 * Last reply from: [Richard](https://wordpress.org/support/users/richardelovia/)
 * Last activity: [3 years, 11 months ago](https://wordpress.org/support/topic/cant-target-form-with-javascript/#post-15772250)
 * Status: resolved