我在文档加载时需要帮助。在我的国家/地区选择框字段中选择的IP国家/地区代码。
我尝试过这个功能,但它没有用。
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 as $cl):?>
<option value="<?php echo $cl['id'] ?>"
for ="<?php echo $cl['internet'] ?>" ><?php echo $cl['name'] ?></option>
</select>