How to check the datatable version I am using
Asked Answered
G

2

11

I am using the following function to get the version of Datatable I am using :

alert($.fn.DataTable.versionCheck());

But I am getting error as :

$.fn.DataTable.versionCheck is not a function

What is wrong in my code?

Gargle answered 11/8, 2015 at 4:29 Comment(0)
T
19

The code you are using is designed to check the current version number against the provided version number, for example:

$.fn.dataTable.versionCheck('1.9.2')

will check if the version number you are using matches 1.9.2. You are not providing a parameter to the function.

I believe the $.fn.dataTable.versionCheck() function was added in version 1.10, so if you are running an older version that may explain why you are getting your error message.

You can use the following code to get the version number:

$(document).ready(function(){
    $('#myTable').DataTable();

    var versionNo = $.fn.dataTable.version;
    alert(versionNo);
});

Please see demo here. Hope it helps.

Triturable answered 11/8, 2015 at 8:13 Comment(0)
L
3

I know this is old, but you can just go to your browser console and run:

$.fn.DataTable.version
Leavenworth answered 27/4, 2021 at 17:3 Comment(1)
Wasn't $.fn.dataTable.version already recommended 6 years earlier? Just a few inches above this answer? You saw that, right?Naturism

© 2022 - 2024 — McMap. All rights reserved.