텍스트가 있고 사용자가 5-10 자 길이의 텍스트 만 입력 할 수 있도록하려면 javascipt를 사용하여 어떻게해야합니까?
mix
및 max
기능을 사용해 보았지만 숫자 데이터에만 적용됩니다.
다음과 같이 할 수 있습니다.
`
function checkLength(){
var textbox = document.getElementById("textbox");
if(textbox.value.length <= 10 && textbox.value.length >= 5){
alert("success");
}
else{
alert("make sure the input is between 5-10 characters long")
}
}
</script>
<input type="text" id="textbox"></input>
<input type="submit" name="textboxSubmit" onclick="checkLength()" />
`
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다