I get this error on line below. How to solve this??
jQuery('span.facebookbtn, .fb-like-box').exists(function() {
load('//connect.facebook.net/en_US/all.js#xfbml=1', 'fbjssdk');
}
I get this error on line below. How to solve this??
jQuery('span.facebookbtn, .fb-like-box').exists(function() {
load('//connect.facebook.net/en_US/all.js#xfbml=1', 'fbjssdk');
}
Assuming you want to load the data if the element exists on the page:
Jquery has no "exists" function. Instead we use ".length".
Example:
if (jQuery('span.facebookbtn, .fb-like-box').length)
load('//connect.facebook.net/en_US/all.js#xfbml=1', 'fbjssdk');
Do you have defined exists
function? I am not aware that it's a built in function,
Perhaps you should use length
functuion instead:
if (jQuery('span.facebookbtn, .fb-like-box').length){
load('//connect.facebook.net/en_US/all.js#xfbml=1', 'fbjssdk');
}
There is no exists()
function in jQuery (see this question), you either have to define it first (jQuery.fn.exists = function(){return this.length>0;}
) or use the length
property directly for checking the existence of an element as suggested by the jQuery documentation.