[英]in a javascript object, what's best way to get the attribute of a value?
[英]What is the best way to get a Meta Element's Attribute Value in JS?
像這樣:
this.token = document.getElementById("token").getAttribute("content");
更好的是, by Name
獲取meta元素
嘗試這個:
document.querySelector('meta[name="name"]').getAttribute("content");
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.