javascript - Trigger change function and set the value of select in jquery? -


hi having given code

$('#filled-in-box2').on('click', function () {     if ($('#filled-in-box2').is(':checked')) {         $('select#employee_permanent_address_attributes_country').val($('select#employee_contact_attributes_country').val()).change();       $('select#permanent_address_state_code').val($('select#contact_state_code').val());     } }); 

so want after change function or when change function trigger @ time permanent_address_state_code value set same contact_state_code value. have tried code not working

$('#filled-in-box2').on('click', function () {     if ($('#filled-in-box2').is(':checked')) {         $('select#employee_permanent_address_attributes_country').val($('select#employee_contact_attributes_country').val()).trigger('change',function(){             $('select#permanent_address_state_code').val($('select#contact_state_code').val());         });      }   }); 

i attachiing snapshot when click on check box not populate state enter image description here

please guide me how solve this. in advance.

$('#filled-in-box2').on('click', function () {    if ($('#filled-in-box2').is(':checked')) {                           $('select#employee_permanent_address_attributes_country').val($('select#employee_contact_attributes_country').val());     $('select#permanent_address_state_code').val($('select#contact_state_code').val());   }  }); 

this alone work requirement change permanent state , country when click on checkbox.


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -