Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript jquery help

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #30225
    cybershot
    Participant

    I am writing some jquery to load content and I am trying to use vars. I tried it like this

    var $about = $(‘#loadContent’).load(‘about.html’);

    the problem is that the div that I want to load the about.html page into shows the content even though that is a variable above. I would think in order to show the content, I would have to do $about.show();

    Got any clue?

    #79925
    doobie
    Member

    The way jQuery works is that when you apply a method to a jQuery object, as in your var statement, it returns a jQuery object. Basically, when you declare the var $about, you are running the load() method on the #loadContent jQuery object. If you want the load method to run later on, apply that method later on when you’re ready for it.

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.