JS check if jQuery is available

and dont trust the user ;)
This commit is contained in:
6543 2019-09-18 02:29:57 +02:00
parent f029789e11
commit 4e68338082
Signed by: 6543
GPG Key ID: A1CA74D27FD13271
1 changed files with 6 additions and 3 deletions

View File

@ -8,10 +8,12 @@


*/ */


/////////////////////////////////////////////////
// Be sure you already have loaded jQuery !!! //
/////////////////////////////////////////////////


// test if jQuery is available
if(!window.jQuery)
{
console.log("sortt.js: ERROR no jQuery found!");
} else {


//use JQuery to bind event on each <th> with a "data-sortt" attribute //use JQuery to bind event on each <th> with a "data-sortt" attribute
$('th').each(function() { $('th').each(function() {
@ -23,6 +25,7 @@ $('th').each(function() {
}); });
}); });


}


//create global function with main routine //create global function with main routine
window.sortt=function(normsort,revsort,isdefault){ window.sortt=function(normsort,revsort,isdefault){