Get Attribute Value of a Selected Option in Dropdown or Select

<select class=”dropdown”>
     <option value=”a” attribute=”b“>c</option>
</select>

$(“.dropdown”).live(“change”, function () {
    //to get b
     var attribute_value= ($(‘option:selected’, this).attr(‘attribute’));
});

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.