Lynx Lynx
Lynx Lynx

Reputation: 1

Multiple js with (document).ready(function()

I have on my page a search system , a slideshow and a carousel running with js, but the carousel doesn't run :

The search begins with :

$('document').ready( function() {
            $("#search_query_top")

The slideshow begins with :

$(window).load(function()
{
    init_slideshow()
})

The carousel begins with :

jQuery(document).ready(function() { 
            $("ul.carruselhome").simplecarousel({

The problem, I think is here :

$('document').ready( function() 

When I disable the line from the search system :

$('document').ready( function() ; //the carousel works...

I tried to change the ready syntax on the carousel script , but nothing happens, I want to fix that only in the carousel script .
The ('document') doesn't affect anything.

Upvotes: 0

Views: 153

Answers (3)

Gung Foo
Gung Foo

Reputation: 13558

the .ready() function attaches an event handler for the "ready" event of the document. those eventhandlers are not being overwritten by successive calls to the register function (.ready())..

Your problem is a typo: 'document' would look for a tag named document..

try

$(document).ready()

:)

Regards!

Upvotes: 1

GautamD31
GautamD31

Reputation: 28763

Its not

$('document').ready( function() {

but its

$(document).ready( function() {

Upvotes: 2

Sibu
Sibu

Reputation: 4617

You should include all your remaining handlers inside one .ready function like

 $(document).ready( function() {
    // 1st handler

    //2nd handler

    });

Upvotes: 0

Related Questions