Contenteditable attribute
How can I configure max开发者_运维技巧imum number of rows in contenteditable
attribute?
I want to stop use after they will reach his capacity of characters for send in POST method.
I'm just using HTML 5. It's a new atributte, you can google it. It's value can be true or false. Contenteditable is not using windows enccoded new lines like: \r\n
, but using creating divs and adding <br>
tags to it.
You could just run some JavaScript on the element, like so:
function check_len(){
//disable editing, or something here
if (element.innerHTML.length >= POST_limit)
alert('you have reached the post limit');
}
And you could attach it to a keyup handler
element.addEventListener('keyup',check_len,false);
精彩评论