jQuery中的元素属性只能添加字符串型的属性值,例如: myDiv.attr("isOpen",true); console.log(typeof myDiv.attr("isOpen"));//打印出来的是string 就算我们设的是布尔值,也会被强制转换成字符串类型