jQuery Select box value of drop down not filled/selected in other drop down value. I did R&D for auto fill value drop down based on the other drop down value selection.
I have presenting one demo example for How to change drop down value of shipping country based on billing country while you checked ship to same address.
Step 1 :Create simple HTML drop down for billing and shipping address
Step 2 : jQuey Select box call selectbox() function to the drop down. It will apply custom CSS in particular drop down
Step 3 : Change shipping country value based on billing country while you checked ship to same address.
ship_country_id generating input box for display text in drop down that text box name is in this example as ship_country_id_input using val() function set text of billing country in shipping country dropdown
I have presenting one demo example for How to change drop down value of shipping country based on billing country while you checked ship to same address.
Step 1 :Create simple HTML drop down for billing and shipping address
Step 2 : jQuey Select box call selectbox() function to the drop down. It will apply custom CSS in particular drop down
$("#bill_country_id").selectbox(); $("#ship_country_id").selectbox();
Step 3 : Change shipping country value based on billing country while you checked ship to same address.
$("#chk_swap_bill_ship").change(function () { if (this.checked) { var selectBox = 'bill_country_id_input_'+$("#bill_country_id").val(); $("#ship_country_id_input").val($("#"+selectBox).text()); $("#ship_country_id").children('option').get(0).blur(); $("#ship_country_id").trigger('click'); } });
- You need to get text of billing country drop down. It will be store the text in input box which is applied by jQuery select box code. It would be in your id of dropdown_input ex.bill_country_id_input
var selectBox = 'bill_country_id_input_'+$("#bill_country_id").val();
- Now you need to that billing country name in shipping country drown using below code
$("#ship_country_id_input").val($("#"+selectBox).text());
ship_country_id generating input box for display text in drop down that text box name is in this example as ship_country_id_input using val() function set text of billing country in shipping country dropdown
0 comments:
Post a Comment