javascript - Insert country code to phone input field with jQuery -
javascript - Insert country code to phone input field with jQuery -
in "contact us" form, need insert country code (ie 972, 1, 91) phone input field after choosing country select list. example; if user chooses "us" list, phone input field start number "1" , user go on write number. how do jquery?
thank you
you can purchase adding value code of country us
value of alternative should 1
your html should be,
<select id="country"> <option value="">select country</option> <option value="1">us</select> <option value="91">in</select> </select><br/> code: <input type="text" id="code" />
jquery
$(function(){ $('#country').on('change',function(){ $('#code').val(this.value);// changing code textbox value current country value }); });
javascript jquery
Comments
Post a Comment