Advertisement
cyter

modifying_selectpicker_class

Sep 20th, 2016
451
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.51 KB | None | 0 0
  1. $(document).ready(function(){
  2.     var sel_size = 0;
  3.     var selected = "";
  4.     /* Upon selecting an African country */
  5.     $(".africa").change(function(){
  6.         selected = $(".africa option:selected").text();
  7.         sel_size = safaris[selected].length;
  8.  
  9.         console.log("selected: "+selected);
  10.         console.log(selected+" attractions: "+sel_size);
  11.            
  12.         for(var i = 0; i < sel_size; i++){
  13.             $(".attractions").prepend("<option>"+safaris[selected][i]);
  14.         }  
  15.     });
  16. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement