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>
Comments
Post a Comment