Click here to Skip to main content
16,017,944 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
VB
if (_arrCheckpoints.length > 0) {
                       var _yr = new Array();
                       var x = 0;
                       var _strHTML2 = "<div id='yrd' onclick='hidemonth();'><ul class='nav'>";
                       for (var i = 0; i < _arrCheckpoints.length; i++) {

                           var _Ayr = _arrCheckpoints[i].substring(_arrCheckpoints[i].length - 4)

                           if (_yr != _Ayr) {

                               x++;
                               if (_yr[i-x] != _Ayr) {

                                   _yr.push(_Ayr);

                               }

                           }


                       }

                       for (var i = 0; i < _yr.length; i++) {

                           _strHTML2 += "<li><span onclick='scrollWin(\"" + _yr[i] + "\");' >" + _yr[i] + "</span></li>"
                           _strHTML2 += "<div id='mnd' ><ul class='nav'>";
                           for (var j = 0; j < _arrCheckpoints.length; j++) {

                               if (_yr[i] == _arrCheckpoints[j].substring(_arrCheckpoints[j].length - 4)) {

                                   _strHTML2 += "<li><span onclick='scrollWin(\"" + _arrCheckpoints[j] + "\");' >" + _arrCheckpoints[j].substring(0, _arrCheckpoints[j].length - 4) + "</span></li>"
                               }

                           }

_strHTML2 += "</ul></div>";
                       }
 _strHTML2 += "</ul></div>";
                       $("#divFilter").html(_strHTML2);

                   }


 function hidemonth() {
            debugger;
            $("#mnd").hide();
        }



Output:

VB
2014
March
February
January
2013
December
November
September
July
June
April
March
February
January



On click of year, months should hide/show please help
Posted
Updated 9-Apr-14 20:05pm
v4

1 solution

Just give id of Div Dynamically as well

like

JavaScript
if (_arrCheckpoints.length > 0) {
<div id="Div"+_arrCheckpoints[i].id+"" onclick="hidemonth("+arrCheckpoints[i].id+");">.......

}



function hidemonth(Value)
{
  $("#Div"+Value).fadeOut();

}

</div>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900