tags:

views:

58

answers:

4

I want to check the size of the string entered in a text box. what am I missing?

var com = document.getElementById("comment").value;
if(com.lenght <= 100){
 alert("good");
} else {
 alert("bad");
} 
+5  A: 

Try changing lenght to length.

Mark Byers
+1  A: 

It is written length not lenght.

jpabluz
A: 

misspelled lenght - should be length

Marek Karbarz
A: 

Mis-spelling:

if(com.lenght <= 100){

use this:

if(com.length <= 100){
Sarfraz