Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>A few things here. First, your HTML, as @David said, seems malformed. Try not using inline Javascript and CSS. This is never good for your application/website. Use the below HTML as a guide:</p> <pre><code>&lt;div class="row clearfix"&gt; &lt;label for="CountyTab" class="label"&gt;County: &lt;/label&gt; &lt;select id="CountyTab"&gt; &lt;option value=""&gt;Choose one&lt;/option&gt; &lt;option value="Antrim"&gt;Antrim&lt;/option&gt; &lt;option value="Westmeath"&gt;Westmeath&lt;/option&gt; &lt;option value="Wexford"&gt;Wexford&lt;/option&gt; &lt;option value="Wicklow"&gt;Wicklow&lt;/option&gt; &lt;/select&gt; &lt;/div&gt; </code></pre> <p>As for the second bit of the HTML, try not using additional elements for clearfix. We have pure CSS tricks for dealing with clearing floats. Additional elements are not good for semantic.</p> <pre><code>label { color: #c0c0c0; } label:hover { color: #0050ff; } .row { padding-left: 26%; position: relative; } .row .label { left: 0; position: absolute; width: 25%; } /* Add the class "clearfix" to any element in your HTML is equal to adding &lt;div style="clear: both;"&gt;&lt;/div&gt; below that element */ .clearfix:before, .clearfix:after { content: " "; display: table; } .clearfix:after { clear: both; } .clearfix { *zoom: 1; } </code></pre> <p>NOW to answer your original question, as @adeneo said, use the <code>change</code> event. See the code below:</p> <pre><code>document.getElementById("CountyTab").onchange = function(evt) { alert(evt.target.value); } </code></pre> <p>The above attaches the <code>change</code> event to the element with the ID "CountyTab." Whenever the value of that element changes, the event gets fired. The function on the right side of that statement then gets called, which takes the event as a parameter. That specific code will alert the selected values of the select element.</p> <p>Please see the jsfiddle for all of the above in action: <a href="http://jsfiddle.net/ninty9notout/UNL9D/" rel="nofollow">http://jsfiddle.net/ninty9notout/UNL9D/</a></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload