Get Value of OPTION TAG

by Kushal Jayswal

HTML

<select>
    <option>1</option>
    <option>2</option>
    <option>3</option>
    <option>4</option>
    <option>5</option>
</select>
<p>Selected Value: <strong></strong>
</p>

JavaScript

$(document).ready(function () {
    $("select").each(function (index) {
        var a = $('option:selected').text();
        $('p strong').html(a);
        $(this).change(function () {
            var a = $('option:selected').text();
            $('p strong').html(a);
        });
    });
});