How to Make the Widget JS Unique to the Widget?

Table of Contents

In the WDesignKit Widget Builder, you have the ability to make the JavaScript code specific to the widget, ensuring that it only affects that particular widget. This allows you to customise the behaviour and functionality of the widget without interfering with other parts of your website. 

To check the complete feature overview documentation of The WDesignKit Widget Builder, click here.

Requirement  – This feature is a part of The WDesignKit, make sure it’s installed & activated to enjoy all its powers.

If you are using the document object in your Javascript to add interactivity to your widget it can affect other elements on the page as well, if there are any common elements.

You have an option in the WDesignKit Widget Builder to make your js specific to the widget.

To do so go to the JS tab of the Editor panel and delete the document object and click on the $Scope button on the right sidebar, it will add a Widget Scope to make the js specific to the widget only.

If you are using any external js library for your widget you can easily add them by clicking on the + button in the JS tab.

widget builder js tab

Also, check How to Make the Widget CSS Unique to the Widget.

AUTHOR
Sagar Patel
CEO
icon
10+ Years Experience

Sagar is the Founder & CEO of POSIMYTH Innovations, with 10+ years building WordPress products trusted by 100,000+ websites globally. He has led the development of The Plus Addons for Elementor, Nexter, WDesignKit, and UiChemy, all built hands-on from concept to launch. His work focuses on making website building faster, more flexible, and accessible for creators and businesses worldwide.