Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check the datatable version I am using

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?

like image 755
Shivkumar Mallesappa Avatar asked Aug 11 '15 04:08

Shivkumar Mallesappa


1 Answers

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.

like image 122
Ash Avatar answered Oct 23 '22 13:10

Ash