www.webdeveloper.com
Results 1 to 2 of 2

Thread: jQuery obj null = error?

  1. #1
    Join Date
    Sep 2009
    Posts
    146

    jQuery obj null = error?

    i have the following code, in my doc.load on my script.js file:
    Code:
        $('.innerPage_nav li a').each(function () {
            $(this).prepend("<span></span>");
        });
    and it works great, more importantly if i have that code on a page that does not have any ".innerPage_nav li a" elements the page still loads fine

    But i am trying to include my script.js file into another site and when i do i get a JS halt error because ".innerPage_nav li a" does not exist? (says object is null)

    what could be different that would cause jQuery to keep going if the element isn't there in one case, but halt in another?

    Thanks,
    -aPeg

  2. #2
    Join Date
    Sep 2009
    Posts
    146
    turns out it was a "$" conflict with some other JS files that was brought in.

    pure guess that i figured that out, its odd any errors like that ive hit in the past created much different errors.

    for anyone reading this having the same prob... change "$" to "jQuery" and that will fix your prob

    -aPeg

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles