Hi,

I am very new in writing javascript so please apologize for that if I am asking very simple things.
I am trying some thing like this but it's not working:

<script type="text/javascript">
    $(document).ready(function() {
        $("#accordion").accordion();
    });
    $(window).load(function() {
        $('#slider').nivoSlider(200);
    });
</script>

Please can anyone help me regarding this.

I have two div's in the html one div I want to rotate the picture whereas in second one I want accordion. For this to happen I am using jquery API's.

Thanks in advance.

---
Neetu

Dani AI

Generated

Quick summary tied to the thread: the accordion needs only the DOM to exist while the slider usually needs images to finish loading. The usual culprits are script-order problems, missing plugin files, or initializing widgets before their libraries are available. was right to check paths, and gave the right next step: inspect the browser console and network panel.

Checklist to run through (in order):

  • Confirm jQuery is loaded first, then jQuery UI, then any slider plugin, then the page initialization script.
  • Verify each script and CSS file returns 200 in the Network tab and that there are no 404s.
  • Make sure only one jQuery copy is included; duplicate versions cause subtle breakage.
  • Check markup ids/selectors match the init code and that required CSS (jQuery UI, slider CSS) is present.
  • Isolate the problem by creating a minimal test page with only jQuery, the plugin, the markup, and the init code.

Common console messages and what they mean:

  • "is not a function" -> plugin file not loaded or loaded before jQuery.
  • "$ is not defined" -> jQuery did not load or is in noConflict mode.
  • Loader/network errors -> wrong paths or blocked resources.

Timing note: initialize DOM-only widgets on DOM-ready and initialize things that depend on images (sliders) after the window load event. See the jQuery ready docs and the browser load event docs for the differences: jQuery .ready() and Window load event (MDN). Also confirm accordion details on the jQuery UI Accordion docs.

Final tips: check the plugin docs for the correct initialization signature (some expect an options object), try a CDN fallback pattern, and reproduce the issue in a tiny standalone page to rule out conflicts from other scripts.

Recommended Answers

All 2 Replies

Are all paths correct ? To jQuery, and the plugins ?

Use firebug in firefox or chrome's web development tool, see the console tab and you can see the specific error occured.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.