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?
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.