Limit length of characters in htm in javascript -


i have question. used editable plugin in octobercms project. can't find in documentation. how can limit length of characters in content in html. if there no way how can javascript? tried use code low in javascript.

var x = document.getelementbyid('gallery');   var tekst= x.outertext;   console.log(tekst);   console.log(x.outertext.length);   if (x.outertext.length > 150) {    var trimmedstring = tekst.substring(0, 150);  document.getelementbyid('gallery').outertext = trimmedstring;   } 

but text not use dic , classes , editable. can fix this?

maybe should in html instead.

<form action="demo_form.asp">   username: <input type="text" name="usrname" maxlength="10"><br>   <input type="submit" value="submit"> </form> 

http://www.w3schools.com/tags/att_input_maxlength.asp


Comments

Popular posts from this blog

Lists in Python -

android - can not access to progress bar in an other activity -

java - Vaadin 7 Pass Data Between Views -