0

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.

Mat
  • 202,337
  • 40
  • 393
  • 406
Lynx Lynx
  • 1
  • 1

3 Answers3

2

Its not

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

but its

$(document).ready( function() {
GautamD31
  • 28,552
  • 10
  • 64
  • 85
1

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!

Gung Foo
  • 13,392
  • 5
  • 31
  • 39
  • From the [API](http://api.jquery.com/ready/): "The .ready() method can only be called on a jQuery object matching the current document, so the selector can be omitted." It seems like it will work regardless of what you actually put in. – Anthony Grist Sep 10 '12 at 13:01
0

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

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

    //2nd handler

    });
Sibu
  • 4,609
  • 2
  • 26
  • 38
  • 1
    There's absolutely no requirement to group them all together. If you're going to say "You should ..." then you also need to back that up with some reasons. – Anthony Grist Sep 10 '12 at 12:59