Answer the question
In order to leave comments, you need to log in
How to pass value from site link to Select?
Hello everyone
. I have this site link: mysite.com/about/en
I also have a select with values:
<select class="select__language">
<option value="en">English</option>
<option value="pl">Polish</option>
<option value="fr">French</option>
</select>
Answer the question
In order to leave comments, you need to log in
get the xref line, split it by /, take the last element - voila, got your fr or whatever...
getElementBy Classname( 'select__language' ).options - got a list of options.
We sort through, compare the value, give the required attribute selected.
Profit.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question