<p contenteditable="true"></p>
How to limit the number of characters that can be entered
<p contenteditable="true">1</p> $ele.onkeyup = function(){ var _html = this.innerHTML; if(_html.length > 10){ this.innerHTML = _html.substr(0,10); this.blur(); } }
Set innerHTML.length="number of characters"
Restrict through js, refer to: http://stackoverflow.com/ques...
<p id="test" contenteditable="true"></p> <script type="text/javascript"> document.querySelector('#test').addEventListener('keypress',function(e) { if(this.innerText.length>=10) { e.preventDefault(); } }); </script>
Set innerHTML.length="number of characters"
Restrict through js, refer to: http://stackoverflow.com/ques...