Forums

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

Home Forums JavaScript /SOLVED/ What is wrong? (toggle)

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #179968
    ThatCat
    Participant

    Hi !

    I will be brief. I have a code to show / hide images (Javascript) operating in “jsFiddle” but not in my web. Anybody can tell me what is the error?

    Does not work in Chrome or Firefox.

    Attached a screenshot of the code in Dreamweaver.

    http://jsfiddle.net/qdhkcz7h/

    #179970
    ThatCat
    Participant

    DAMN. Ok, I know what is the error.

    My code did not have the “document ready function“.

    #180038
    dyr
    Participant

    Alternatively, you can follow current best practices and put all your javascript just before the closing body tag and omit the .ready() call since by the time your JS executes the document will be ready.

    There are certain exceptions to this best practice but in general most external JS files should be loaded at the end of the document before the closing body tag.

    #180132
    ThatCat
    Participant

    Thank you, dyr! :)

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