Search code examples
javascriptjoomlamootoolsjoomla-extensions

mootools document.getelement is not a function


I'm trying to convert a Joomla 1.5 plugin to Joomla 2.5 plugin. As this plugin is runnning, Firebug says `TypeError: document.getElement is not a function. Here is my code....

   var btn = document.getElement("#imageForm fieldset div [onclick=\"\"]");
                        console.log(btn);
                        if (btn.getAttribute("onclick").indexOf("ImageManager") > -1 )
                        {
                            if (typeof window.parent.'.$request['rewrite_function'].' === "function")
                            {
                                btn.setAttribute("onclick",btn.getAttribute("onclick").replace("ImageManager.onok()","window.parent.'.$request['rewrite_function'].'()"))
                            }
                        }

I have been stuck on this for hours now and I can't get it to work. Could you please tell me what is wrong with this javascript or atleast point me in the right direction.


Solution

  • I recently had this issue when I was trying to use jquery and mootools on the same page. I solved the problem by adding jquery's no conflict at the top of my html and whenever I made a jquery call, I used the $j variable I created instead of the shortcut $:

      <script type="text/javascript">
        jQuery.noConflict();
        var $j = jQuery;
      </script>