Custom Dropdown or select box using CSS - css

<select>
<option value="1">One</option>
<option value="2">Two</option>
<option value="3">Three</option>
</select>
this is a normal select box in which when we select one, its value changes to One. But let me know is it possible to set value 1 when I select one
like the image shown down
I think here we set +297 as the value for the option Aruba
You can also suggest any other alternative way to do so

Related

Bootstrap 4 - Assign placeholder to <select> form input

I've searched a bit but the found solutions here on SO seems not working for me. I have a select input field and I want to assign it a placeholder. I'm using bootstrap 4 and to manage the front-end.
As I understand from the documentation I need to assign the selected hidden or selected disabled to the <option> tag I want to use as placeholder. I've tried but didn't worked.I don't know if this is because I'm using vue.js, is there a fix?
<label>Filter List</label>
<select
class="form-control"
v-model="listFilter"
v-on:change="filterList()"
>
<option value="" selected disabled class="text-hide">Select filter</option>
<option value="a">All</option>
<option value="f">Fe</option>
<option value="m">Mas</option>
<option value="s">Tru</option>
<option value="c">Cou</option>
</select>

Wordpress Settings API update_option for select option with text area

How can i create different option and update them with update_option?
For each option there should be a text area witch should be updated
<select>
<option value="option-one"></option>
<textarea>option-one</textarea>
<option value="option-two"></option>
<textarea>option-two</textarea>
<option value="option-three"></option>
<textarea>option-three</textarea>
</select>
How can i do this?

How to reinitialize dynamic Semantic UI Search Dropdown

How can I reinitialize selectdd2 dropdown option on change of selectddl dropdown? Anyone can help me on this?
For example : If we select country the corresponding states will be loaded in second dropdown.
HTML Code
<select class="ui search selection dropdown dropdown-spinner" id="selectdd1">
<option value="">Select Country</option>
</select>
<select class="ui search selection dropdown dropdown-spinner" id="selectdd2">
<option value="">Select State</option>
</select>
There is no need reinitialize your dropdown input , all you need is to change options dynamically in select element (state) when the value of your first select element (country) is changed ,by listening to onchange event.
Here is a simple demo example , and here is an example with Semantic-UI countries flags

select dropdown too large (Bootstrap)

Ok, so i have a simple thing on my website where users can enter a phone number and text them, so when they enter the phone number they need to select an item in a dropdown list with all country dial codes, the problem is that the dropdown list is as long as my textbox which makes everything look quite awkward, I've done some research and have messed around with it myself without any luck, just for an example here is what i am talking about (btw i use the bootstrap framework so any answer would need to support bootstrap)
As you can see the text box is actually smaller than the dropdown list which makes it look kinda weird, i would like to somehow scale down the dropdown so it looks better along side my text field.
Thanks for reading, any help will be appreciated!
EDIT:
My current code for this <select> dropdown looks like this
<select class='form-control'>
<option value='213'>Algeria (+213)</option>
<option value='376'>Andorra (+376)</option>
<option value='244'>Angola (+244)</option>
<option value='1264'>Anguilla (+1264)</option>
<option value='1268'>Antigua & Barbuda (+1268)</option>
<option value='54'>Argentina (+54)</option>
<option value='374'>Armenia (+374)</option>
<option value='297'>Aruba (+297)</option>
<option value='61'>Australia (+61)</option>
//There is more countries..... I just cut it here so it won't be too long
</select>

How do I preselect in a drop down list box? [duplicate]

This question already has answers here:
How can I set the default value for an HTML <select> element?
(34 answers)
Closed 3 years ago.
I am trying to preselect like this:
<option selected="yes" value="test1" >test1</option
But I get a message in VS2010 saying "Validation HTML5: The value permitted for this attribute do not include 'yes'.
Am I doing something wrong. I thought the way to preselect was as above.
it should be selected="selected"
<option selected="selected" value="test1" >test1</option>
Selected attribute only contain selected value, like this:
<option selected="selected" value="test1">test1</option>
<option selected="selected">test1</option>
Would be the correct way to do it, AFAIK.
try selected="selected" or you can just leave the selected without any value like <option selected>test1</option>

Resources