jQWidgets Forums
jQuery UI Widgets › Forums › Editors › Editor › jqxeditor using $ global variable
Tagged: jquery noconflict
This topic contains 4 replies, has 2 voices, and was last updated by StevenChapman 10 years, 2 months ago.
-
Author
-
jqxeditor.js starts like this:
(function(c){$.jqx.jqxWidget(“jqxEditor”,””,{});……..
This causes a console error of “$.jqx undefined” if using a framework in addition to JQuery which uses $, like Prototype. This should be changed to:
(function($){$.jqx.jqxWidget(“jqxEditor”,””,{});……..
Or something similar so that the variable $ is local.
Thanks,
SteveHi Steve,
There is absolutely no bug in our code here! If you want to use $ for other framework, you may probably need to learn how to use jQuery’s noConflict function. More information: http://www.jqwidgets.com/jquery-widgets-documentation/documentation/jquerybasics/jquerybasics.htm and https://api.jquery.com/jquery.noconflict/
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comI’m well aware of how to use the noConflict function of JQuery. That’s how we’re using Prototype and JQuery in the same web app. I’m just pointing out to you that there is a single widget in your code that uses the global $ variable instead of scoping it locally, and could be fixed with a single character change. From jqx-all.js (3.5):
(function(a){a.jqx.jqxWidget("jqxPasswordInput","",{});a.extend... (function(a){a.jqx.jqxWidget("jqxRangeSelector","",{});a.extend... (function(b){b.jqx.jqxWidget("jqxDataTable","",{});b.extend... (function(a){a.jqx.jqxWidget("jqxTreeGrid","jqxDataTable",{});a.extend... (function(a){a.jqx.jqxWidget("jqxBulletChart","",{});a.extend... (function(c){$.jqx.jqxWidget("jqxEditor","",{});$.extend... (function(a){a.jqx.jqxWidget("jqxNotification","",{});a.extend....
Notice anything different about that jqxEditor line? I do. It’s using the global $ instead of the local c. This resulted in a JavaScript error even though I was using noConflict, until I moved the noConflict call to be after the jqwidget include. So yes, there is a workaround. I was just trying to be helpful by pointing out that if changed that “c” argument to “$”, no one would ever see this problem.
Thanks,
SteveHi Steve,
I don’t know how it was in ver. 3.5 from SEP-2014, but Facts are that in 3.7.1 from FEB-2015 – There is no such issue!. If you post an issue, please post it about a current release.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comPeter,
Yes I see the fix in the new version, thanks for letting me know. We’ll upgrade. While this comment was critical, we are big fans of your widgets here at Boeing. Very impressive visually and affordable.
Thanks,
Steve -
AuthorPosts
You must be logged in to reply to this topic.