How can i add a Select Option in AMP - drupal

I have a page with a Select Option
but in my AMP Page i cant see this element,
What i need to add to this work?

For navigate the page use AMP.navigateTo
<select on="change:AMP.navigateTo(url=event.value)">
<option selected>-Select a Page-</option>
<option value="YOUR-PAGE-URL">Home Page</option>
<option value="YOUR-PAGE-URL">About Us</option>
<option value="YOUR-PAGE-URL">Camping Tips</option>
</select>

Related

Wordpress wrap select element with div

I'm making an e-commerce and on my single product page (working with Woocommerce) i would like to add an icon to the select element at the right (dropdown icon). but i can't do a pseudo class before or after to the select element. So i need to wrap the select element to add it to the class of the div?
The code at the moment:
<select id="pa_farbe" class="" name="attribute_pa_farbe" data-attribute_name="attribute_pa_farbe" data-show_option_none="yes">
<option value="">Wählen Sie eine Option</option>
<option value="gruen" class="attached enabled">Grün</option>
<option value="kupfer" class="attached enabled">Kupfer</option>
<option value="lachs" class="attached enabled">Lachs</option>
<option value="tuerkisblau" class="attached enabled">Türkisblau</option>
<option value="violett" class="attached enabled">Violett</option>
</select>

css select dropdown bold on some <option>'s

On a select dropdown, I need to make certain items 'strong/bold'.
How can I do this?
Example of what I ideally require:
<option value="#"><strong>Andorra</strong></option>
<option value="#">--Grandvalira</option>
<option value="#">--Vallnord</option>
<option value="#"><strong>Austria</strong></option>
<option value="#">--Amadé</option>
<option value="#">--Bad Kleinkirchheim</option>
<option value="#">--Mallnitz</option>
You actually can't.
The closest thing (you can't choose a bold item)
<optgroup label="Swedish Cars">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
</optgroup>
<optgroup label="German Cars">
<option value="mercedes">Mercedes</option>
<option value="audi">Audi</option>
</optgroup>
Which gives you this:
http://www.w3schools.com/tags/tryit.asp?filename=tryhtml_optgroup
You can also build one of your own but it won't be input an input tag (you should use inputs of your own).
you could use :nth-child(N)
option:nth-child(1), option:nth-child(4) {
font-weight:bold;
}
Demo: http://jsfiddle.net/Sotiris/sqshN/
Find more info and browser support for this pseudo-class at http://reference.sitepoint.com/css/pseudoclass-nthchild
Using css in the works as a quicker, easier alternative
<option value="value" style="font-weight: bold;">SELECT ME</option>
You could do it with jQuery.
$('#Your select').append($("<option></option>").attr.css("font-weight" , "bold").html("Bold Text"));
You'd have to add some logic to determine which options to bold, obviously.
This also works (Firefox 50 and Chrome 55). Items 3 and 5 are shown in bold
<style>
.bld {font-weight:bold;}
</style>
<select>
<option value = "1">Kanakangi
<option value = "2">Ratnangi
<option class = "bld" value = "8">Hanumatthodi
<option value = "9">Dhenuka
<option class = "bld" value = "15">Mayamalavagowla
<option value = "16">Chakravaaham
</select>

Dropdown is not showed completelly the first time the page showed

I have a dropdownlist declared like this:
<select id="PageToCreate_AuthorID">
<option value="">Please select...</option>
<option value="1">Thierry</option>
<option value="2">Vanessa</option>
</select>
When the page is showed the fist time, here is what is displayed:
As you can see, we don't see all the text inside the control.
Then I click inside it and the dropdown is adjusted:
How can I do to have the dropdown showed correctly when the page is showed the first time?
Thanks.
Try to add some css for your select tag :
<select id="PageToCreate_AuthorID">
<option value="">Please select...</option>
<option value="1">Thierry</option>
<option value="2">Vanessa</option>
</select>
Css:
#PageToCreate_AuthorID {
min-width:200px; /* Change this value if you think you must do it */
}

Hyper Link inside html select control

I have a html select control. I want to have a item which is a link to navigate to some other page, when it is selected with out postbacking.
Thanks in advance
How about this ?
<select onchange="location=this.options [this.selectedIndex].value;">
<option>- Select -</option>
<option value="http://www.google.com" >Google</option>
<option value="http://www.facebook.com" >Facebook</option>
<option value="http://www.stackoverflow.com" >Stackoverflow</option>
</select>

Functions php, make drop down list work

In functions php, this works like a charm:
<textarea name="menu1anchor" id="menu1anchor" cols="40" rows="1"><?php echo get_option('menu1anchor'); ?></textarea>
How can i make this drop down list work? I want to be able to input my values and select a desired one later on.
Right now, it does not matter which value I select, after i press "save changes" it does not send my value thru the form to wordpress options.
<select name="menu1" id="menu1">
<option value="1">Microsoft</option>
<option value="2">Google</option>
<option value="3">Apple</option>
</select>
Thank u!
<select name="menu1" id="menu1">
<option value="1"<?php selected(get_option('menu1'),1); ?>>Microsoft</option>
<option value="2"<?php selected(get_option('menu1'),2); ?>>Google</option>
<option value="3"<?php selected(get_option('menu1'),3); ?>>Apple</option>
</select>
Try that instead.

Resources