Skip to content Skip to sidebar Skip to footer

"cannot Read Property ... Of Undefined" In Jquery 1.11.0 -- How Can I Satisfy Jquery's Requirement?

I was (trying to) load jQuery 1.9.1 un-minified from CDN: 'Uncaught TypeError: Cannot call method 'call' of undefined jquery-1.9.1.js:648'. So I updated the reference, and am appar

Solution 1:

You have incorrect syntxis

What do you whant to do with ?

jQuery(function()
    {
    jQuery.each(jQuery('h1').add('h2').add('h3').add('h4').add('h5').add('h6').add('ul#navigation')).function(index, element)
        {
        var bounds = jQuery(element).offset();
        var image_left = bounds.left;
        var image_top = bounds.top + bounds.height;
        var image = jQuery('<img src="/media/images/foldback.png">');
        image.style.position = 'absolute';
        image.style.top = image_top + 'px';
        image.style.left = image_left + 'px';
        }
   function set_search_width()
        {
        var offset = 950;
        var width = jQuery(window).width() - offset;
        jQuery('#menu-search').css('max-width', width + 'px');
        jQuery('#menu-search').css('width', width + 'px');
        jQuery('#query').width(width - 80);
        }
    jQuery(window).resize(set_search_width);
    set_search_width();
    });

maybe code below is what you want ? ( find elements, i think it is better use complex selector, and apply function to each element )

jQuery('h1').add('h2').add('h3').add('h4').add('h5').add('h6').add('ul#navigation').each(function(index, element)
    {
    var bounds = jQuery(element).offset();
    var image_left = bounds.left;
    var image_top = bounds.top + bounds.height;
    var image = jQuery('<img src="/media/images/foldback.png">');
    image.style.position = 'absolute';
    image.style.top = image_top + 'px';
    image.style.left = image_left + 'px';
    });

Solution 2:

The offending line is: site.js line 26

if should be something like

jQuery.each(jQuery('h1').add('h2'), function(index, element) { ... })

not

jQuery.each(jQuery('h1').add('h2')).function(index, element) { ... }

Post a Comment for ""cannot Read Property ... Of Undefined" In Jquery 1.11.0 -- How Can I Satisfy Jquery's Requirement?"