Dear experts,
I am having trouble trying to use the javascript library 'dataTable'.
I have done this :
1 - build a child theme
2 - build functions.php in the child theme
3 - call javascript datatable libraries and a specific library with enqueue function.
A test function is working, so it seems OK but the rest is not working.
Here's my code on my page :
<div class="tableau">
<script type="text/javascript"><!--//--><![CDATA[//><!--
tableau();
//--><!]]></script>
</div>
<A href="javascript:;" onClick="test();">Texte1</A>
Here's my code on my specific library :
// Fonction de mise en forme de tableau
function tableau() {
$(document).ready( function () {
$('#sommets').dataTable( {
"dom": 'T<"clear">lfrtip',
"tableTools": {
"sSwfPath": "/DataTables/extensions/TableTools/swf/copy_csv_xls_pdf.swf"
}
} );
} );
}
function test() {
alert('fdfdsfds');
}
Firebug keeps saying my function tableau is not defined except when I erase all spaces like this :
<div class="tableau"><script type="text/javascript"><!--//--><![CDATA[//><!--tableau();//--><!]]></script></div>
...but then it is doing nothing.
I have tried to apply the best practice of this page https://codex.wordpress.org/Using_Javascript but I do not know how to make it work.
The function test is working but the other one is doing nothing. Do someone use datatable and could show me an example ?
Thank you very much for your help.
Ben