Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

concatenation of loop data in variable using jquery

Below you can check the example of concate data in variable through for loop in jquery
Please refer '+=' in the code for concatenation example

var timedropdowndata = "<select name='select_time'><option>Select time</option>";
for(var hours=0; hours<24; hours++){
  for(var mins=0; mins<60; mins+=30){
    let timestamp = hours+":"+mins;
    timedropdowndata += "<option>"+timestamp+"</option>";

  } // the interval for mins is '30'
} // the interval for hours is '1'
timedropdowndata += "</select>";

I hope it will help you
thank you.
 
PREVIOUS NEXT
Tagged: #concatenation #loop #data #variable #jquery
ADD COMMENT
Topic
Name
3+7 =