1. When we have a div set contenteditable = "true" This block element can be edited, if you want to implement placeholder direct write up is not effective
<div contenteditable= "true" placeholder= "please write infomation" ></div>//no effect
2. You can add styles to implement
*[contenteditable= "true"]:empty:before{ content:attr (placeholder); Color: #A9A9A9; }
This code matches the attribute contenteditable= "true" when the element class capacity is empty when added: before pseudo element
attr (Placeholder) Gets the value of the property placeholder assigned to the content so that you can emulate the placeholder property in the Implementation text box,
3. When the first display in the Ipone machine is OK, when you enter the content and then empty the discovery does not show the contents of the placeholder, this is because this editable block is not empty at this time, there are newline characters,
If we have to use jquery,zepto and so on we can get the text () of this element, and then assign the value "" with this element;
If we use JS, innertext to get the value of the block element, you will find that whether your value is empty is true, there is no way to determine when I am empty (only in Ipone),
And then I went to see how the text () in jquery is implemented, using a Textcontent property that can be used to determine
The mobile pit is implemented in an editable div placeholder