replacing page content with .html(content) is not working - javascript

I have a weird problem in jQuery. The problem is that I can smoothly use $('#container').html(content) to replace the page content but to specific page. It is not working all around. Gives 'TypeError' message in console. Is there any probability that using SlickGrid can cause such error. Because error is thrown only in that pages where I have used SlickGrid.
Any suggestion would be highly appreciated.

It's hard to tell what's going on with your page, but my guess is that you may have a conflict with the $ between jQuery and SlickGrid. Look at the noConflict function in jQuery - it may help you out.
Call $.noConflict(); before SlickGrid's javascript <script> tag is added, and then refer to jQuery functions by using jQuery(selector) instead of $(selector).
Hope this helps!

Related

Object has no method error after no conflict

I am working on a site where I am using Scott Robbins pageslide to show/hide a responsive navigation.
For some reason the pageslide navigation works fine on the rest of the site but, when it gets to the contact page, it breaks: http://kevinpresbrey.com/contact
I took a look at the console in Chrome and I'm getting this error:
Object [object Object] has no method
I updated the jQuery call for pageside from this:
$(".open").pageslide({ direction: "right"});
To this:
jQuery(".open").pageslide({ direction: "right"});
and it's still blowing the error and causing the pageslide not to function on the contact page.
Like I mentioned before, it works fine on all the other pages, but the contact page. I have a feeling that the embedded form that was generated from constant contact might be causing the issue, but other than that, I have no idea.
Any suggestions?
You have multiple versions of jQuery in your code, which could be causing the problem (even though some of the other code seem to be working). You have v1.8.3 and v1.8.2.
One of them is being pulled from:
http://www.formstack.com/forms/js/3/jquery.min.js
the other one from:
http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js?ver=3.6
Fix that and your code should work.
Ok, I figured out what it was.
Looks like it was partially from what Hanlet said. There were two version of jQuery that were being pulled.
Apparently when I commented out the code that pulls in jQuery within my functions.php file it defaulted to the version that comes baked in with Wordpress which is version 1.10.2 and that apparently fixed the issue.
So, yeah. Hooray...I guess?
"pageslide" is not a build-in method for jquery selectors. You may want to double check if you include the "pageslide" javascript library / jquery plugin correctly.

`The function $(Window) is undefined` err in jquery

I used the Jquery 1.9.1 and used the code to fire when browser window will get closed as
My JSP will be ,
But this shows a red underline error like show in picture in eclipse.
I don't know why I am getting this error.Can any one help me to solve this.
Don't hesitate to ask any question.
Good answers are definitely appreciated.
Have you tried wrapping the code in doc ready handler:
$(function(){
//here unload and before unload
});
and you have to look that your jquery 1.9.1 is properly loading.
about error:
That is quite possible if you are using a CDN Hosted jQuery library. Try loading it locally and referencing it from there.
$ is an alias for jQuery. If $ is undefined it means the jQuery library has not been properly loaded. Be sure to include it in the page before attempting to use any jQuery methods.

How do I use jQuery.noConflict();

After installing lightbox for my website my comments stopped working. I looked at the code and moved the javascript links that were in the <head> (the ones that came with lightbox) in the to above the javascript links that came with Wordpress-Buddypress. Before my javascript links from Lightbox were below the javascript links that came with Wordpress.
After making the switch, the comments started working again on my website but now the lightbox does not work.
When I use Firebug to find errors, I get this error.
$("#videogallery a[rel]").overlay is not a function
That code comes from "videolightbox.js" which was a file that came with my lightbox.
I did lots of reseach on this problem and I am thinking that I might need to use jQuery.noConflict(); but I have no idea how to use it? I was looking at this link
but I can't seem to get it to work because I have no idea how to use it. I also tried replacing all the $() with jQuery() but that did not solve my problem.
but I have no idea how to use it?
var $j = jQuery.noConflict();
and your code will change from
$(selector) to $j(selector)
A lot of examples are given here
http://api.jquery.com/jQuery.noConflict/
One thing to consider closely is the script loading order and watch for repeat loading of JQuery. In some (hopefully rare) situations, you can load JQuery, set up some code that uses it, then reload JQuery which tosses away the events that were set up after loading it the first time.
I know I ran into that situation once, but I can't remember the details that led to it occurring.
To your answer
$=jQuery.noConflict();
Now you can use $('#id').css(...);
The error is probably causing the rest of the code not being executed, .overlay is not a function means that .overlay is not a function and $ is working fine.
var test; test("#videogallery a[rel]").test()
//TypeError: test is not a function <-- You would see this if $ wasn't working
var test = function(){return {};};
test("#videogallery a[rel]").test();
//TypeError: test("#videogallery a[rel]").test is not a function <-- You see this because .overlay isn't working
It simply means you are trying to call .overlay before it exists.

Javascript and Jquery issue

Hello I am using a zoom plugin called cloudzoom on a weebly website, it was working partially and now it has stopped working.
http://cadogan.weebly.com/big-name.html
I add jquery no conflict etc. But, I think I have something wrong on the page regarding how I loaded the cloud zoom possibly.
Assitance will be most appreciated.
Thank you.
I had a problem using jquery in weebly sites, I resolved it with this three steps.
a) Try copy and pasting the raw jQuery file onto the page. between the markup
b) use jQuery.noConflict(); after the jquery call
c) change the "$()" for "jquery()" when you call the custom function.
I hope it helps you.
regards,
William Hernández
www.floopie.net

jQuery call followed by clicking accordion control fires Ms Jscript error

I have jquery modal that works perfectly fine.
But after closing this modal and clicking on accordion control(MS ajax) fires
Jscript runtime error
Microsoft JScript runtime error:
Sys.ArgumentTypeException: Object of
type
'AjaxControlToolkit.AccordionSelectedIndexChangeEventArgs'
cannot be converted to type
'Sys.CancelEventArgs'. Parameter name:
instance
I have done days of searching. But I couldn't find a solution to this.
I have tried scriptmode="Release". Single reference call to the jquery file.
I read some parts saying that some it helped some people to turn of smart navigation but I couldn't find how to do so.
If anyone has any idea on this it will be much appreciated.
Please.. Help~!
I've solved this issue by putting this
var $j = jQuery.noConflict();
at the end of my jquery.js file and referencing all jquery functions with a $j, instead of $
Ok I found the problem. One of the controls inside the container(div) which is loaded by jquery was throwing an error. So in this case, the error message did not help much to track that particular control down.
Thanks a lot for your effort guys!.

Categories