Use created attribute with javascript in select list

前端 未结 1 844
礼貌的吻别
礼貌的吻别 2021-01-24 01:22

im trying to access an attribute that i created in a select list.



        
1条回答
  •  青春惊慌失措
    2021-01-24 01:58

    Try this:

    var newUrl = document.getElementById('test').getAttribute('car');
    

    EDIT

    For the itself:

    var select = document.getElementById('test');
    select.options[select.selectedIndex].getAttribute('car');
    

    0 讨论(0)
提交回复
热议问题