输入回车换行,div标签可编写

将contenteditable设置为true就可编写

<div contenteditable= "true" class="textareaDiv" id="ceshiId" placeholder="请输入"></div>

给div标签添加placeholder
样式:

.textareaDiv:empty:before{
	content: attr(placeholder);
	color: #ccc;
}

取消选中边框outline: none;

.textareaDiv{
	padding: 12px 0;
	font-size: 15px;
	outline: none;
}

获取输入参数可用原生js获取值

document.getElementById('ceshiId').innerText

你可能感兴趣的:(js,前端,javascript,html)