Title: JavaScript in Tab
Last modified: September 4, 2017

---

# JavaScript in Tab

 *  Resolved [johniko](https://wordpress.org/support/users/johniko/)
 * (@johniko)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/javascript-in-tab/)
 * Hi there,
 * can I run my own JS in one Tab?

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

 *  Plugin Contributor [yikesitskevin](https://wordpress.org/support/users/yikesitskevin/)
 * (@yikesitskevin)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/javascript-in-tab/#post-9469224)
 * Hi [@johniko](https://wordpress.org/support/users/johniko/),
 * What exactly are you trying to achieve? You can add scripts to the product page
   that can interact with your custom tab content. If you explain to me what you’re
   trying to do I can help figure out the best way to accomplish it.
 * Let me know,
    Kevin.
 *  Plugin Contributor [Tracy Levesque](https://wordpress.org/support/users/liljimmi/)
 * (@liljimmi)
 * 🏳️‍🌈 YIKES, Inc. Co-Owner
 * [8 years, 8 months ago](https://wordpress.org/support/topic/javascript-in-tab/#post-9491124)
 * Hi [@johniko](https://wordpress.org/support/users/johniko/),
 * We haven’t heard back from you in awhile so I am going to close out this ticket.
 * If you need more help, please reopen it and we will be happy to help you.
 * Thank you!
    -Tracy
 *  Thread Starter [johniko](https://wordpress.org/support/users/johniko/)
 * (@johniko)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/javascript-in-tab/#post-9542315)
 * Hi there!
    Sorry for my late reply! Yes, I would like to add javascript to each
   product page. What is the best way to do this?
 * The output will be in my custom tab via css.
    Looks like this: `<div id="output"
   ></div>`
 *  Plugin Contributor [yikesitskevin](https://wordpress.org/support/users/yikesitskevin/)
 * (@yikesitskevin)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/javascript-in-tab/#post-9542449)
 * Hi [@johniko](https://wordpress.org/support/users/johniko/),
 * I wouldn’t recommend this unless you know what you’re doing.
 * However, here is a function that will check if we’re on a single product page.
   You can then use the `wp_enqueue_script` function to load your JS file in the
   normal WP way.
 *     ```
       // Enqueue a JS file when on a single product page
       add_action( 'wp_enqueue_scripts', 'add_javascript_to_product_pages', 10, 1 );
   
       function add_javascript_to_product_pages( $page ) {
       	global $post;
   
       	// Make sure we're on a product page
       	if ( is_single() && is_object( $post ) && $post->post_type === 'product' ) {
       		// wp_enqueue_script();
       	}
       }
       ```
   
 * Cheers,
    Kevin.
 *  Thread Starter [johniko](https://wordpress.org/support/users/johniko/)
 * (@johniko)
 * [8 years, 7 months ago](https://wordpress.org/support/topic/javascript-in-tab/#post-9569470)
 * Hi Kevin,
 * I think it is not that easy. I would like to send you my script, but it does 
   include some details about my customer. How can I send you a pm?
 * Best regards!
    Niko
 *  Plugin Contributor [yikesitskevin](https://wordpress.org/support/users/yikesitskevin/)
 * (@yikesitskevin)
 * [8 years, 7 months ago](https://wordpress.org/support/topic/javascript-in-tab/#post-9569597)
 * Hi Niko,
 * Sure – email me at kevin at yikesinc dot com.

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

The topic ‘JavaScript in Tab’ is closed to new replies.

 * ![](https://ps.w.org/yikes-inc-easy-custom-woocommerce-product-tabs/assets/icon-
   256x256.png?rev=1558461)
 * [Custom Product Tabs for WooCommerce](https://wordpress.org/plugins/yikes-inc-easy-custom-woocommerce-product-tabs/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/yikes-inc-easy-custom-woocommerce-product-tabs/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/yikes-inc-easy-custom-woocommerce-product-tabs/)
 * [Active Topics](https://wordpress.org/support/plugin/yikes-inc-easy-custom-woocommerce-product-tabs/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/yikes-inc-easy-custom-woocommerce-product-tabs/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/yikes-inc-easy-custom-woocommerce-product-tabs/reviews/)

## Tags

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

 * 6 replies
 * 3 participants
 * Last reply from: [yikesitskevin](https://wordpress.org/support/users/yikesitskevin/)
 * Last activity: [8 years, 7 months ago](https://wordpress.org/support/topic/javascript-in-tab/#post-9569597)
 * Status: resolved