I know I can set selected attribute for a select tag with old put filed:
<select name="country" id="state" onChange="loadlist(this.value);" >
<option value="usa" >USA</option>
<option value="grm" >Germany</option>
<option value="eng" >England</option>
</select>
But in that form, I have another select tag that use from a Jquery file for load options:
<select name="state" id="state" class="form-control arrow-black">
<option value="">Select country</option>
</select>
the Jquery codes:
function loadlist(country){
with(document.getElementById('state'))
{
options.length = 0;
if(country == ''){
options[0] = new Option('Select country' , '');
}
if (country == 'usa') {
options[0] = new Option('Select' , '');
options[1] = new Option('NewYork' , 'NewYork');
options[2] = new Option('Florida' , 'Florida');
options[3] = new Option('California' , 'California');
}
if (country == 'grm') {
options[0] = new Option('Select' , '');
options[1] = new Option('Bayern' , 'Bayern');
options[2] = new Option('Hamburg' , 'Hamburg');
options[3] = new Option('Berlin' , 'Berlin');
}
if (country == 'eng') {
options[0] = new Option('Select' , '');
options[1] = new Option('Buckingham' , 'Buckingham');
options[2] = new Option('Cambridge' , 'Cambridge');
options[3] = new Option('London' , 'London');
}
}
}
how can I set for the 2nd select tag?
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3mV12Np
via IFTTT
Aucun commentaire:
Enregistrer un commentaire