• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Drop Down List do not create when more elements added

 
Nakata kokuyo
Ranch Hand
Posts: 467
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good day All,

i using PHP for the project to create a SELECT/Drop down for the Country and state



Code to create Drop-down list and i putting this way


FYI, fillCategory() in fact is a function with PHP code which get the value from database. the value here are where i captured from Firefox error console, the strange case here is if i have put limitation for DB query like "SELECT * from country limit 10" , then it will generate the Drop down list but not the case of full list.

Can any expert here point out what's wrong on my JS script ?

thank you for your guidance !
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Change to



I personally would do it like this:


Eric
 
Nakata kokuyo
Ranch Hand
Posts: 467
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Eric for the guidance

i just have 1 more question, by looking at the code below



Why we do not need to increment the length of the options and it will allow continue add on new option
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are adding an option to the next available position in the list. Just like how you add a new option to an array.

Eric
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic