Search
 
SCRIPT & CODE EXAMPLE
 

HTML

length

<input type="text" id="name" name="name" required
       minlength="4" maxlength="8" size="10">
Comment

check input length

//Use the code below to set min and max characters for an input
//grabbing element from the DOM
const username = document.getElementById('username');

function checkLength(input, min, max) {
  if(input.value.length < min)
  {//below can be applied to a field, etc
    console.log(`${input.id} must be at least ${min} characters`)
  }
  else if(input.value.length > max){
    console.log(`${input.id} must be less than ${max} characters`)
  }
}
//call function
checkLength(username, 3, 15)
Comment

PREVIOUS NEXT
Code Example
Html :: how to make a clickable image in html 
Html :: bootstrap responsive meta tag 
Html :: body on start do function javascript 
Html :: html insert remote image 
Html :: hotlink html 
Html :: how to make images load as you scroll down 
Html :: crossorigin attribute values 
Html :: how to add placeholder in type date 
Html :: action button dropdown 
Html :: randome code 
Html :: Bootstrap Carousel Image Not Display in Full Width 
Html :: how to put images in html 
Html :: Can I customize the Work Order Tablet View? I want all the buttons at the top. odoo 
Html :: onclick open new url html 
Html :: timestamp trigger is not defined 
Html :: bootstrap color class 
Html :: use of extends in html django 
Html :: What Is the Metaverse? 
Html :: event input svelte 
Html :: metasploit default login 
Html :: facebook seo meta tags 
Html :: whitespace code 
Html :: html input checkbox example 
Html :: happy birthday html animation 
Html :: ion-searchbar debounce 
Html :: input textbox size 
Html :: swiper js pagination with arrows 
Html :: how to insert images into html 
Html :: html video play pause 
Html :: how to make href open in a new tab link html 
ADD CONTENT
Topic
Content
Source link
Name
6+1 =