So this is a very simple code.
Essentially we can use this logic for other html elements as well. Since I encountered such a situation. Posting this for the dropdown element.
wmdropdown_countrycode:- id of dropdown 1
wmdropdown_nationality:- id of dropdown 2
myfunction() {
change(function(){
var selectedCountry = $(this).attr('value');
find('option').each(function()
{
if($(this).val().toLowerCase()
== selectedCountry.toLowerCase()) {
selected');
Essentially we can use this logic for other html elements as well. Since I encountered such a situation. Posting this for the dropdown element.
wmdropdown_countrycode:- id of dropdown 1
wmdropdown_nationality:- id of dropdown 2
$(
'#wmdropdown_countrycode').
$(
'#wmdropdown_nationality').
$(
this).attr('selected','
}
});
});
}
No comments:
Post a Comment