AngularJS - get element attributes values

后端 未结 8 1389
深忆病人
深忆病人 2020-12-04 12:24

How do you get an element attribute value?

e.g. HTML element:

         


        
8条回答
  •  渐次进展
    2020-12-04 12:44

    Since you are sending the target element to your function, you could do this to get the id:

    function doStuff(item){
        var id = item.attributes['data-id'].value; // 345
    }
    

提交回复
热议问题