showing results for - "concatenation of loop data in variable using jquery"
Paola
22 Sep 2016
1Below you can check the example of concate data in variable through for loop in jquery
2Please refer '+=' in the code for concatenation example
3
4var timedropdowndata = "<select name='select_time'><option>Select time</option>";
5for(var hours=0; hours<24; hours++){
6  for(var mins=0; mins<60; mins+=30){
7    let timestamp = hours+":"+mins;
8    timedropdowndata += "<option>"+timestamp+"</option>";
9
10  } // the interval for mins is '30'
11} // the interval for hours is '1'
12timedropdowndata += "</select>";
13
14I hope it will help you
15thank you.