Articles in this section
Category / Section

How to avoid "Object doesn't support property ej" error in JavaScript ?

2 mins read

Problem

When you run the application, runtime error is thrown as “Syncfusion is undefined” or “Object doesn’t support property or method ej”.

Reason

The above mentioned exception occurs, when the Syncfusion component script files are not referred properly.

Solution

The following Scripts and theme files are necessary for your components.

HTML

<head>

    <!--Contains the necessary theme for our componets-->

    <link href="default-theme/ej.web.all.min.css" rel="stylesheet" />

    <!--dependency script files-->

    <script src="scripts/jquery-1.10.2.min.js"></script>

    <script src="scripts/jsrender.min.js"></script>

    <!--contains the necessary scripts to render all the web components-->

    <script src="scripts/ej.web.all.min.js"></script>

</head>

 

In the above code example, the scripts referred to the folder in which the script files are stored. Make sure that the above mentioned script files are loaded properly.

You need to load ej.web.all.min.js file even when you use mobile components. Refer to the following link to know more about the scripts files and dependencies.

https://help.syncfusion.com/js/dependencies?_ga=2.216000023.1886322782.1658118340-779596233.1646205657

Make sure that all the necessary dependency script files are included.

When you refer individual script files of the components instead of using the ej.web.all.min.js file, make sure all the dependency script files of the component are included.

For example, to use the Treeview component alone in your application and when you want to use only the script files needed by the Treeview component instead of using the entire ej.web.all.min.js file, refer to the following code example for the script files that are necessary for the Treeview component.

HTML

<head>

  <!--Contains the core CSS required for our components-->

    <link href="themes/ej.widgets.all.min.css" rel="stylesheet" />

    <!--necessary dependency script files-->

    <script src="scripts/jquery-1.10.2.min.js" type="text/javascript"></script>

    <script src="scripts/jsrender.min.js" type="text/javascript"></script>

    <!--scripts neccessary for autocomplete component-->

    <script src="scripts/ej.core.min.js" type="text/javascript"></script>

    <script src="scripts/ej.data.min.js" type="text/javascript"></script>

    <script src=" scripts/ej.draggable.js"></script>

    <script src=" scripts/ej.checkbox.js"></script>

    <script src=" scripts/ej.treeview.js"></script>

    <script src=" scripts/ej.waitingpopup.js"></script>

</head>

 

If you fail to load any dependency script file that are necessary for the Treeview component, then the error “object doesn’t support ej” occurs. For example, if you fail to include the “ej.checkbox.min.js” file, then on rendering the page, “Object doesn't support property or method 'ejCheckBox’” error is thrown.

How to identify the necessary scripts and dependencies of a particular component.

Refer to the following class reference link for JavaScript and click on the required component name. You can find the required script files for each component under the heading Requires.

https://help.syncfusion.com/api/js/global

As an alternate solution to load the components, you can use the CDN links as follows.

HTML

<head>

    <!--Contains the necessary theme for our componets-->

    <link href="http://cdn.syncfusion.com/15.2.0.40/js/web/flat-azure/ej.web.all.min.css" rel="stylesheet" />

    <!--dependency script files-->

    <script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>

    <script src="http://cdn.syncfusion.com/js/assets/external/jsrender.min.js"></script>

    <!--contains the necessary scripts to render all the web components-->

    <script src="http://cdn.syncfusion.com/15.2.0.40/js/web/ej.web.all.min.js"></script>

</head>

 

In the CDN link http://cdn.syncfusion.com/15.2.0.40/js/web/flat-azure/ej.web.all.min.css”, “15.2.0.40” refers to the release version.

 

You can find the CDN links for External dependencies and Syncfusion dependencies in the link below.

https://help.syncfusion.com/js/cdn

 

Conclusion

I hope you enjoyed learning about how to avoid "Object doesn't support property ej" error in JavaScript.

You can refer to our  JavaScirpt Controls page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our example to understand how to create and manipulate data.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied