日常小记

HTML文本框限制最少输入字数

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>select选择-按钮跳转</title>
<script type="text/javascript">
function checklength(){

var dom= document.getElementById('mytext').value;
if(dom.length<20){

alert("最少输入20个汉字");
return false;

}
</script>
</head>
<body>
<form method="get" action="" onsubmit="return checklength()">

         个人描述:
           <textarea rows="4" class="form-control2" placeholder="最少输入二十个字" id="mytext"></textarea>
           <button type="submit" class="btn btn-danger" ><h4>提交</h4></button>

</form>

</body>
</html>

回复

This is just a placeholder img.