I would like to search without diacritics in my table. I have DataTables plugin and I want to add dataTable accent neutralise I tried many possibilities, but I dont know still where to exactly place this code or something similar:
<script>
$(document).ready( function () {
jQuery.fn.DataTable.ext.type.search.string = function ( data ) {
return ! data ?
'' :
typeof data === 'string' ?
data
.replace( /έ/g, 'ε' )
.replace( /[ύϋΰ]/g, 'υ' )
.replace( /ό/g, 'ο' )
.replace( /ώ/g, 'ω' )
.replace( /ά/g, 'α' )
.replace( /[ίϊΐ]/g, 'ι' )
.replace( /ή/g, 'η' )
.replace( /\n/g, ' ' )
.replace( /á/g, 'a' )
.replace( /é/g, 'e' )
.replace( /í/g, 'i' )
.replace( /ó/g, 'o' )
.replace( /ú/g, 'u' )
.replace( /ê/g, 'e' )
.replace( /î/g, 'i' )
.replace( /ô/g, 'o' )
.replace( /è/g, 'e' )
.replace( /ï/g, 'i' )
.replace( /ü/g, 'u' )
.replace( /ã/g, 'a' )
.replace( /õ/g, 'o' )
.replace( /ç/g, 'c' )
.replace( /ì/g, 'i' ) :
data;
};
var table = $('#tabulka_kariet').DataTable();
} );
</script>
When I have cleaned code only with dataTable and with this script and table , everything is working fine. Working demo
But in my web this script is not working.
This is my heading:
<head>
<meta charset="UTF-8">
<title>Požičovňa náradia</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet"href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" href="jquery/dataTables.bootstrap.min.css" />
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.15/css/jquery.dataTables.min.css"></link>
<script src="jquery/accent-neutralise.js"></script> <!-- At this row I tried to load script from website -->
<link rel="stylesheet" href="style.css">
</head>
<body>
And this is my footer:
</body>
<!-- Jquery -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<!-- Datatables -->
<script src="https://cdn.datatables.net/1.10.15/js/jquery.dataTables.min.js"></script>
<!-- Bootstrap -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<script>
$(document).ready(function() {
$('#tabulka_kariet').DataTable();
} );
</script>
</html>