我正在尝试将自定义元素添加到 Select html 元素。
var sel=document.getElementById("sel1");
sel.setAttribute("customprop","blabla");
在 chrome 中它可以工作,在 IE8 中它没有。
没有查询
我正在尝试将自定义元素添加到 Select html 元素。
var sel=document.getElementById("sel1");
sel.setAttribute("customprop","blabla");
在 chrome 中它可以工作,在 IE8 中它没有。
没有查询
检查问题:Replace setAttribute with IE compatible script
看来您需要在页面顶部添加 doctype:
<!DOCTYPE html>
然后在您的 head 元素中添加以下标签以使 setAttribute 工作:
<meta http-equiv="X-UA-Compatible" content="IE=edge" />