Help with using multiple Mootools scripts

Discussion in 'Web Design and Development' started by Ad Pro, Apr 28, 2009.

  1. Ad Pro macrumors member

    Joined:
    Jul 4, 2007
    Location:
    UK
    #1
    I am having difficulty getting mootools Accordion and mootools Request.html to work on the same page. They both work individually but not together. I presume there is a clash somewhere.

    Thanks in advance for any help.
     
  2. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #2
    Seeing the code would help. Do you have a link?
     
  3. Ad Pro thread starter macrumors member

    Joined:
    Jul 4, 2007
    Location:
    UK
    #3
    Here is the code which I am trying to get to working:

    View attachment site.zip

    The accordion works, but the mootools request.html only works on its own - if I remove the accordion js (or the link to the accordion.js file)
     
  4. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #4
    In accordion.js on line 26 you have
    PHP:
    //add click event to the "add section" link
    $('add_section').addEvent('click', function(event) {
    but I don't see anything in your source with 'add_section' and believe that's why it's getting an error currently. There's only one link in the source and looks like,
    HTML:
    <a href="#" id="makeRequest">Load text</a>
     
  5. Ad Pro thread starter macrumors member

    Joined:
    Jul 4, 2007
    Location:
    UK
    #5
  6. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #6
    Well you still have that bit of JavaScript that I listed earlier, it's what's giving the error in Error Console. When I comment it out there's no more errors.

    The link for the request doesn't work, but that's because I'm running it locally and AJAX only works properly when on the server. So I can't really test that part out too much. Nothing in the code stands out as an obvious issue to me though.
     
  7. Ad Pro thread starter macrumors member

    Joined:
    Jul 4, 2007
    Location:
    UK
    #7
    Ooops, so i did.

    Thanks - It works perfectly now. Thanks so much for your help!!


    May I ask what Software you are using / how you are checking for errors in the code ?
     
  8. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #8
    Firefox is my main browser and under the Tools menu there's an option for Error Console (Safari has this as well as most browsers do). I also use the Console^2 add-on, which makes it slightly more powerful. That's all I used here, but I also use the Web Developer Toolbar add-on frequently when helping on this type of problem as well as Firebug.
     
  9. Ad Pro thread starter macrumors member

    Joined:
    Jul 4, 2007
    Location:
    UK
    #9
    awesome, I will look further into this, think It will come in useful in the future. Thanks again.
     

Share This Page