0

I've been having this problem where i couldn't add Datatables.net javascript into my Joomla article. I have been trying to include it through Jumi.

To say that my editor strips of the tag is somewhat not right as I have been able to execute Google Chart API in Joomla which also uses javascript.

Any clue why?

The code is as below :

<link href="//datatables.net/download/build/nightly/jquery.dataTables.css" rel="stylesheet" type="text/css" />
        <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
        <script src="//datatables.net/download/build/nightly/jquery.dataTables.js"></script>
        <script type="text/javascript">
    $(document).ready( function () {
    var table = $('#example').DataTable();
} );
</script>
0

2 Answers 2

0

Unless you have disabled mootools (the default javascript library in Joomla 1.5), then the jquery may well be causing a conflict.

Instead of using $ try using jQuery, ie

jQuery(document).ready

The datatables javascript may also have the same problem.

0

The HTML tag <link> is not allowed in the <body>. Edit the index.php of the template to include the <link> and remove it from the code to be included in the article.

4
  • This is not good practice as it will likely be wiped out with a template update or change.
    – isherwood
    Oct 20, 2014 at 0:44
  • Only when you are stupid enough not to create your own copy of a template when you are going to use it. Or updating without having a backup that you know works because you installed it somewhere else. But yes, those people exist!
    – sovainfo
    Oct 29, 2014 at 12:36
  • It's bad practice to modify component core files regardless of backup protocol. It makes for more maintenance and should always be considered a last resort.
    – isherwood
    Oct 29, 2014 at 13:02
  • Indeed, a lot of people are of that opinion. I disagree, don't consider that bad practise provided you realize the consequenses of customizing. No matter whether you do it in core, via overrides or create your own extensions. The moment you customize/extend you need to migrate instead simply update!
    – sovainfo
    Nov 11, 2014 at 21:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.