I would like to fill my Dropdownlist named "mondayHours" with a for loop with numbers from 1-12 can anyone help me? I read some articles in the web but I couldn't find the right solution.
I have begun with this...
for(i=0; i <= 10; i++){
this.getField("mondayHours").setItems([i.toString()]);
}
But nothing happens.
When I use this, its create dropdown items with 0.25 - ...
this.getField("mondayHours").setItems(["0.25","0.5","1","1.25"....]);
Use something like what I have below...
var hours = [] // an empty array
for(i=1; i <= 12; i++){
hours.push(i); // add each number to the end of the array
}
this.getField("mondayHours").setItems(hours); // set the items list to the array
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.