From 0ba4bb3e26d5ccbcc1eaf1d2555b9ca2d78b9b59 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Wed, 18 Sep 2019 20:42:07 +0200 Subject: [PATCH] restruct code for additional features --- sortt.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/sortt.js b/sortt.js index d85013d..d478b79 100644 --- a/sortt.js +++ b/sortt.js @@ -55,10 +55,16 @@ if(!window.jQuery) { //use JQuery to bind event on each with a "data-sortt" attribute $('th').each(function() { - if ($(this)[0].dataset.sortt) $(this).on('click', function(e) { - var data = $(this)[0].dataset.sortt; - data = data.split(","); - sortt(data[0],data[1],data[2]); - }); + //if data attribute sortt is set + if ($(this)[0].dataset.sortt) { + //add onclick event + $(this).on('click', function() { + var data = $(this)[0].dataset.sortt; + data = data.split(","); + sortt(data[0],data[1],data[2]); + }); + //add arrow to colume + // - place holder - + } }); }