Adding DataTables breaks Jquery dialog and other jquery code

Adding DataTables breaks Jquery dialog and other jquery code

stanley1271stanley1271 Posts: 4Questions: 2Answers: 0

I have simplified my code to find the issue and have found that when I add in DataTables it breaks my existing Jquery code. Below is the coed that works fine until I add in DataTables. Does DataTables load its own version of JQuery?

<script src="Scripts/jquery-3.1.0.min.js"></script>
    <script src="Scripts/jquery-ui.min.js"></script>
    <link href="Styles/HistoryPage/ATIC.css" rel="stylesheet">
<script>
    $(document).ready(function () {
   
        $(function () {
            var wWidth = $(window).width();
            var wHeight = $(window).height();
            var dialog = $("#dialog").dialog({
                dialogClass: "no-close",
                autoOpen: false,
                resizable: false,
                modal: true,
                width: wWidth
            });
             $("#btnPolicyTerms").on("click", function (e) {
                e.preventDefault();
                dialog.dialog("open");
                dialog.dialog('option', 'minWidth', wWidth * 10);
                dialog.dialog('option', 'width', wWidth * 10);
                dialog.dialog('option', 'minHeight', wHeight * 10);
                dialog.dialog('option', 'height', wHeight * 10);

            });
        });
         $(document).on('click', '.close', function (e) {
             var $dialog = $(this).parents('.ui-dialog-content');
             $dialog.dialog('close');
         });
    });

</script>

Answers

  • allanallan Posts: 63,812Questions: 1Answers: 10,516 Site admin

    Does DataTables load its own version of JQuery?

    Only if you tell it to do so in the download builder. DataTables core doesn't have jQuery in it - jQuery is a dependency.

    Thanks,
    Allan

This discussion has been closed.