JavaScript code snippets

Here is a small collection of JavaScript code snippets that I collected. Binding a click event handler in fnRowCallback of DataTables library will fire the event twice, use unbind before to prevent this: $(document).ready( function() { $(‘#example’).dataTable({ “fnRowCallback” : function(nRow, aData, iDisplayIndex) { $(nRow).unbind(‘click’).bind(‘click’, function() { alert(‘click’); }); } }); }); To get the row data of the clicked row […]

Continue Reading