I want an autocomplete field in my page, and my code is right, but it doesn't work. When I used Joomla 2.5 then it worked but I had to change to Joomla 3.2 and it isn't working now. I use these js files:
$doc->addScript(JURI::root().'media/com_szakdolgozat/js/jquery.min.1.4.2.js');
$doc->addScript(JURI::root().'media/com_szakdolgozat/js/typeahead.bundle.js');
$doc->addScript(JURI::root().'media/com_szakdolgozat/js/jquery-ui.min.1.8.1.js');
There is a problem with jquery 1.8.1, because I get error under Joomla 3.2:
Uncaught ReferenceError: jQuery is not defined --> jquery-ui.min.1.8.1.js:10
Which version shall be right for me?
Joomla 3.x comes packed with jQuery by default, therefore you do not need to import your own copy of it. The following code will import it in noConflict mode if it doesn't already detect it:
JHtml::_('jquery.framework');
I think the issue you're having mentioned in your question is that you have 2 instances of jQuery being loaded and therefore it causes conflicts.
Joomla 3.x also has jQueryUI packed with it. So your final code will look like this:
JHtml::_('jquery.framework');
JHtml::_('jquery.ui');
JHtml::_('script', 'media/com_szakdolgozat/js/typeahead.bundle.js');
Related
I am trying to integrate Isotope JS on Joomla 1.5 site. (I know it's old Joomla!)
https://www.buffalobrownies.com/?view=article&id=269
I got the code working fine on a test page on that domain (but outside of Joomla).
Inside Joomla, neither the JQuery nor vanilla JS seems to trigger.
With JQuery trigger code on, I get this error on Chrome Console:
Cannot read property 'isotope' of null
(With the vanilla JS script turned on I get a bunch of OTHER errors......)
So I'm guessing there is something wrong with the reference to $ but I'm not clued up enough to know what it is...
Any thoughts out there? Thanks for your help
(I have Jquery linked high up in the <head>, then Isotope JS link just after, then the isotope trigger JS before the bottom </body> tag)
Chris
So I discovered that it was Mootools in Joomla 1.5 that was causing the conflict.
(I just had to start taking lines of code out, one by one, until I found the one that made the difference).
I managed to find some code online that turned Mootools off for the front end, but kept it on for the back end.
Now I've managed to get the Isotope script working in my example. Now I just need to get it working with live data!
I have visual composer installed on a wordpress site. For some reason when i isert and image or any element and apply the animation from inside visual composer, the page goes blank and nothing shows, no animations, nothing.
After contacting the plugin developer they said another plugin is conflicting but i have just 1 other plugin installed, jetpack. I have uinstalled that and the problem persists.
Using the debug tool i get the following errors. any ideas?
Uncaught TypeError: a.indexOf is not a function
at r.fn.init.r.fn.load (jquery.min.js?ver=3.1.1:4)
at waypoints.min.js?ver=5.0.1:8
at waypoints.min.js?ver=5.0.1:8
at waypoints.min.js?ver=5.0.1:8
at waypoints.min.js?ver=5.0.1:8
Uncaught TypeError: f.getClientRects is not a function
at r.fn.init.offset (https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js?ver=3.1.1:4:20376)
at t.refresh (http://####/wp-content/plugins/js_composer/assets/lib/waypoints/waypoints.min.js?ver=5.0.1:8:2072)
at t. (http://#####/wp-content/plugins/js_composer/assets/lib/waypoints/waypoints.min.js?ver=5.0.1:8:6130)
at Function.each (https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js?ver=3.1.1:2:2865)
at refresh (http:#####/wp-content/plugins/js_composer/assets/lib/waypoints/waypoints.min.js?ver=5.0.1:8:6100)
at Function.n.(anonymous function) [as waypoints] (http://###wp-content/plugins/js_composer/assets/lib/waypoints/waypoints.min.js?ver=5.0.1:8:7638)
at r.fn.init.init (http://####/wp-content/plugins/js_composer/assets/lib/waypoints/waypoints.min.js?ver=5.0.1:8:4817)
at r.fn.init.n.fn.(anonymous function) [as waypoint] (http://######/wp-content/plugins/js_composer/assets/lib/waypoints/waypoints.min.js?ver=5.0.1:8:5712)
at function.window.vc_waypoints.window.vc_waypoints (http://####/wp-content/plugins/js_composer/assets/js/dist/js_composer_front.min.js?ver=5.0.1:1:7243)
By default, the latest version of WordPress uses jQuery version 1.12.4 but your site seems to be calling jQuery 3.1.1 via Google's CDN. It's possible that Visual Composer isn't compatible with jQuery 3 yet.
If this is the only plugin on the site, then it's likely the theme calling this jQuery version. And if it's properly coded, you should be able to find a wp_register_script or wp_enqueue_script function that is overriding the jQuery version. If you replace that with wp_enqueue_script( 'jquery' );, you'll load up WordPress' jQuery which may solve the issue.
Three notes:
The theme may have replaced jQuery by using wp_deregister_script. You'll need to comment that out too.
Changing the jQuery version may break javascript coming from your theme if that js needs jQuery version 3 so look for issues on that end as well.
When you update your theme, it will revert this change. So you should consider doing this through a child theme to preserve your changes across updates.
All of a sudden the nivo slider on one of our clients websites is not showing up at all: www.bedehouse.org
I have tried all sorts but cannot see why its stopped all of a sudden? We have not done any updates to wordpress or any of its plugins recently.
I can see using chromes "inpect element" feature that there is an error: "Uncaught TypeError: $(...).nivoSlider is not a function" but have no idea what it means.
Any helps or pointers in the right direction would be massively helpful.
You're loading two versions of jQuery. One is the copy WordPress is loading and the second is another.
Both are different versions (WP is loading 1.8.3 and you're loading 1.8.2). WordPress loads jQuery in noconflict mode and does not allow the use of the $ shortcut.
Remove the jQuery 1.8.2 call that you made and change all instances of $ to jQuery and try it.
i want to use a plugin in my website. but in website already used 1.8 version of jQuery and my plugin is 1.11 version. now its conflicting. please tell me what should i do. there is some types of error message come up
it says $. something is undefined
and it also says $.() is not a function.
so that it the problem please anybody help me.
You should update your website to use v1.11.2 and only load that version. There are virtually no API-breaking changes from v1.8 to v1.11, the only thing that was actually removed was the toggle(function,function) event hookup (not the toggle show/hide function, which is still there).
There were deprecations:
In 1.8
In 1.9
In 1.10
...so best to check those lists and see if you're using any of those, but they haven't been removed yet (with the exception I mentioned above).
jQuery is mostly backwards compatible. Instead of loading v1.8 and v1.11, just load v1.11. You're plugin will probably still work.
I am using fancybox to display some message and on the same page I tried to add a new JavaScript widget which require jquery 1.4.4 or higher versions.
I used jquery 1.8.3 and after adding this jquery file, alignment or positioning of the box is going wrong. If I don't use latest jquery file, JS widget will not work.
Please let me know how to solve this issue.