下面的代码可以直接复制调试:

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>js获取option中的自定义属性</title>
</head>
<body>
<select name="" id="hello">
<option value="1" path="12-21" selected>55</option>
<option value="1" path="12-21-21">44</option>
<option value="1" path="12-21-21-21">33</option>
<option value="1" path="12-21-21">22</option>
<option value="1" path="12">11</option>
</select>
<script>
var hello = document.getElementById('hello');

hello.onchange = function (){
getValue();
}

function getValue(){
var obj=document.getElementById("hello");
var index=obj.selectedIndex;
var path=obj.options[index].getAttribute("path");//options[index]属性集合中的第几个
alert(path);
return path;
}


</script>
</body>
</html>