Note that there are some explanatory texts on larger screens.

plurals
  1. POpassed variable becomes undefined javascript
    primarykey
    data
    text
    <p>I have 2 function that do that same thing. One works and one doesn't.</p> <pre><code>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 } </code></pre> <p>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.</p> <pre><code>&lt;ul class="dropdown-menu"&gt; &lt;li class="dropdown-submenu"&gt; &lt;a href="#"&gt;Attendance Average&lt;/a&gt; &lt;ul class="dropdown-menu"&gt; &lt;li&gt;&lt;a data-toggle="tab" href="#attendance" onclick="showHideRedrawAttendanceAvg(attendance, 'Weekly')"&gt;Weekly&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a data-toggle="tab" href="#attendance" onclick="showHideRedrawAttendanceAvg(attendance, 'Monthly')"&gt;Monthly&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a data-toggle="tab" href="#attendance" onclick="showHideRedrawAttendanceAvg(attendance, 'Quarterly')"&gt;Quarterly&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a data-toggle="tab" href="#attendance" onclick="showHideRedrawAttendanceAvg(attendance, 'Yearly')"&gt;Yearly&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; &lt;li class="dropdown-submenu"&gt; &lt;a href="#"&gt;Attendance Total&lt;/a&gt; &lt;ul class="dropdown-menu"&gt; &lt;li&gt;&lt;a data-toggle="tab" href="#attendance" onclick=""&gt;Weekly&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a data-toggle="tab" href="#attendance" onclick="showHideRedrawAttendanceCount('Monthly')"&gt;Monthly&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a data-toggle="tab" href="#attendance" onclick="showHideRedrawAttendanceCount('Quarterly')"&gt;Quarterly&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a data-toggle="tab" href="#attendance" onclick="showHideRedrawAttendanceCount('Yearly')"&gt;Yearly&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; &lt;/ul&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload