Getting JavaScript error el.set is not a function Line: 23 in Joomla!

G

How Can We Help?

Getting JavaScript error el.set is not a function Line: 23 in Joomla!

I’ve noticed this error when I installed VirtueMart and in the checkout process where it asks if you are a returning visitor or new user I noticed that the radio buttons did not work. This error occurs since Joomla! uses mootools and I used JQuery in my template. Thus causing the two to conflict since both mootools and JQuery make use of the $-function. Please check the answer to see how you will be able to solve this issue.

Answer:

  1. Add the following code after the inclusion of the JQuery library.
    <script type="text/javascript">
       jQuery.noConflict();
     </script>

    eg.

    <script type="text/javascript" src="<?=JURI::root().'/scripts/jquery-latest.pack.js'?>"></script>
    <script type="text/javascript">
       jQuery.noConflict();
     </script>

    jQuery.noConflict(); overrides JQuery’s $-function

  2. Now replace all $ instances in your code with jQuery eg. $(“#test”) will become jQuery(“#test”)
  3. Refresh your page and the error message should be gone.

About the author

Ian Carnaghan

I am a software developer and online educator who likes to keep up with all the latest in technology. I also manage cloud infrastructure, continuous monitoring, DevOps processes, security, and continuous integration and deployment.

About Author

Ian Carnaghan

I am a software developer and online educator who likes to keep up with all the latest in technology. I also manage cloud infrastructure, continuous monitoring, DevOps processes, security, and continuous integration and deployment.

Follow Me