diff --git a/static/js/pad_editbar.js b/static/js/pad_editbar.js index 71053d0c..9280bc7b 100644 --- a/static/js/pad_editbar.js +++ b/static/js/pad_editbar.js @@ -190,8 +190,11 @@ var padeditbar = (function() } else { - $("#editbar ul#menu_right li:not(:nth-child(" + (modules.indexOf(moduleName) + 1) + "))").removeClass("selected"); - $("#editbar ul#menu_right li:nth-child(" + (modules.indexOf(moduleName) + 1) + ")").toggleClass("selected"); + var nth_child = modules.indexOf(moduleName) + 1; + if (nth_child > 0 && nth_child <= 3) { + $("#editbar ul#menu_right li:not(:nth-child(" + nth_child + "))").removeClass("selected"); + $("#editbar ul#menu_right li:nth-child(" + nth_child + ")").toggleClass("selected"); + } //hide all modules that are not selected and show the selected one for(var i=0;i