jquery - IP-based country code appended dynamically in option box? -


i need in document loading time. ip country code, selected in country selectbox field.

i tried function, not working.

                 var code =geoip_country_code();      //$('#selectcountry').attr('for');     //alert($('#selectcountry').val());       $(function()     {         $('#selectcountry option:selected').attr('for',code);          $('#selectcountry').trigger("change");          alert($('#selectcountry option:selected').val());       });            <select id="selectcountry" name="personal[country]">      <option value="">[select]</option>                           <?php foreach($countrylist $cl):?>      <option value="<?php echo $cl['id'] ?>"            ="<?php echo $cl['internet'] ?>" ><?php echo $cl['name'] ?></option>      </select> 


Comments