I have 2 function that do that same thing. One works and one doesn't.
function showHideRedrawAttendanceAvg(chart, dataType) { $("#attendanceCount").addClass("hide"); $("#attendanceAvg").removeClass("hide"); redrawAttendance(chart, dataType);//Parameters are defined } function redrawAttendance(chart, dataType) //Parameters are passed and are defined { //Some logic } //I tried change the parameter name several times to make sure it was unique function showHideRedrawAttendanceCount(agagfadfg) { $("#attendanceAvg").addClass("hide"); $("#attendanceCount").removeClass("hide"); redrawAttendanceTree(agagfadfg);//Parameter is defined } function redrawAttendanceTree(agagfadfg)//Parameter becomes undefined { //Some logic } I have no idea why the two functions behave differently. I even removed all of my javascript from the file and just left the showHideRedrawAttendanceCount and redrawAttendanceCount functions and it still did not work.
<ul class="dropdown-menu"> <li class="dropdown-submenu"> <a href="#">Attendance Average</a> <ul class="dropdown-menu"> <li><a data-toggle="tab" href="#attendance" onclick="showHideRedrawAttendanceAvg(attendance, 'Weekly')">Weekly</a></li> <li><a data-toggle="tab" href="#attendance" onclick="showHideRedrawAttendanceAvg(attendance, 'Monthly')">Monthly</a></li> <li><a data-toggle="tab" href="#attendance" onclick="showHideRedrawAttendanceAvg(attendance, 'Quarterly')">Quarterly</a></li> <li><a data-toggle="tab" href="#attendance" onclick="showHideRedrawAttendanceAvg(attendance, 'Yearly')">Yearly</a></li> </ul> </li> <li class="dropdown-submenu"> <a href="#">Attendance Total</a> <ul class="dropdown-menu"> <li><a data-toggle="tab" href="#attendance" onclick="">Weekly</a></li> <li><a data-toggle="tab" href="#attendance" onclick="showHideRedrawAttendanceCount('Monthly')">Monthly</a></li> <li><a data-toggle="tab" href="#attendance" onclick="showHideRedrawAttendanceCount('Quarterly')">Quarterly</a></li> <li><a data-toggle="tab" href="#attendance" onclick="showHideRedrawAttendanceCount('Yearly')">Yearly</a></li> </ul> </li> </ul>
function drawAttendanceTree(but you callredrawAttendanceTreeredrawAttendanceTreedefinition before calls..hide()and.show()might be easier to use thanaddClass("hide")andremoveClass("hide").