1

I am working with meteor autoform...

I have an application where I need to select country based on selection of continent. I need country and continent both in select options(drop menu's)...

I don't have any idea how to solve this so I cant post any any code...

I tried this code to fit into autoform but I don't know why I it is not responding with auoform...

<html>
<head>
<script src= "http://code.jquery.com/jquery-1.10.1.min.js "></script>
</head>
<body>
<select id="cat">
    <option val="Asia">Asia</option>
    <option val="Africa">Africa</option>
</select>

<select id="item">

</select>
</body>
<script>
asia_o=new Array("India","China","Pakistan","Japan");
africa_o=new Array('southafrica','tangania','nigeria');
populateSelect();
$(function() {
      $('#cat').change(function(){
        populateSelect();
    });

});

function populateSelect(){

    cat=$('#cat').val();

    $('#item').html('');


    if(cat=='Asia'){
        asia_o.forEach(function(t) { 
            $('#item').append('<option>'+t+'</option>');
        });
    }

    if(cat=='Africa'){
        africa_o.forEach(function(t) {
            $('#item').append('<option>'+t+'</option>');
        });
    }

} 
</script>

</html>

Please help me out of this

Thanks in advance

4

0 回答 0