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

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -