Title: Adding css class with jquery doesnt work
Last modified: August 21, 2016

---

# Adding css class with jquery doesnt work

 *  Resolved [Brendavo](https://wordpress.org/support/users/successful-life/)
 * (@successful-life)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/adding-css-class-with-jquery-doesnt-work/)
 * Hi,
 * I have the latest version of you plugin and as in this thread [http://wordpress.org/support/topic/adding-custom-class-to-fields?replies=2](http://wordpress.org/support/topic/adding-custom-class-to-fields?replies=2)
   
   you said i could add a css class to a field using jquary.
 * I tried adding this to the checkout script box, but it shows errorerror. I also
   tried pasting it in wcpgsk-user.js but that did not change anything either.
    
   $(“#billing_pastastacija_field”).addClass(“secondxxx”);
 * I have no experience with jquery, so am i doing something wrong?
    Please be specific
   how to do this.
 * Thnx
 * [https://wordpress.org/plugins/woocommerce-poor-guys-swiss-knife/](https://wordpress.org/plugins/woocommerce-poor-guys-swiss-knife/)

Viewing 1 replies (of 1 total)

 *  Plugin Author [ulihake](https://wordpress.org/support/users/ulih/)
 * (@ulih)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/adding-css-class-with-jquery-doesnt-work/#post-4696953)
 * Hello Brendavo.
 * You have to encapsulate your script like this to assure that it runs when the
   document is completely available (ready):
 *     ```
       jQuery(document).ready(function() {
       jQuery("#billing_pastastacija_field").addClass("secondxxx");
       });
       ```
   
 * I have tested this and this works.
 * Regards.
    uh

Viewing 1 replies (of 1 total)

The topic ‘Adding css class with jquery doesnt work’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/woocommerce-poor-guys-swiss-knife_ffffff.
   svg)
 * [WooCommerce Poor Guys Swiss Knife](https://wordpress.org/plugins/woocommerce-poor-guys-swiss-knife/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce-poor-guys-swiss-knife/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce-poor-guys-swiss-knife/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce-poor-guys-swiss-knife/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce-poor-guys-swiss-knife/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce-poor-guys-swiss-knife/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [ulihake](https://wordpress.org/support/users/ulih/)
 * Last activity: [12 years, 3 months ago](https://wordpress.org/support/topic/adding-css-class-with-jquery-doesnt-work/#post-4696953)
 * Status: resolved