接遇到容易忘记的问题(二)
11. js获取name
<lable>
<span id="onlinePerson" name="person" onclick="changeImg(this)" >
<img id="imgPerson" src="images/invote-checked.png">个人
</span>
</lable>
function changeImg(obj) {
// console.log(obj.name); //错误的只支持obj.id
// $(obj).attr("name"); //jquery写法
console.log(obj.getAttribute("name"));
}
12.webstorm新建多个项目:File -> settings -> Directories -> Add Content Root 添加新项目->确定即可。
13.多行文本框(文本域)编辑需要高度自适应, 改变不了<textarea>的样式, 只能用<div>模仿了, 使用contenteditable 属性,来规定元素内容是否可编辑。
<div class="liketextarea" contenteditable="true" ></div>
.liketextarea{
width: 100%;
min-height: 1.6rem;
border: none;
background: transparent;
outline: none;
font-size: .26rem;
color: #1c1c1c;
line-height: .44rem;
}
原文:https://www.cnblogs.com/wangduojing/p/10397020.html