<select id="sel">
<option value="1" test="aaa">dsfsdf</option>
<option value="2" test="bbb">ssssss</option>
<option value="3" test="ccc">dggggg</option>
</select>
<span id="check">check</span>
$("#check").click(function(){
console.log($("#sel option").attr("selected", true).attr('test'));
})
LIVE: http://jsfiddle.net/rhqbG/
Now this show me always “aaa”. How can i make it?
You could rewrite it to
http://jsfiddle.net/gYpYV/