javascript - How do you verify input is not null, whitespace or integer? -



javascript - How do you verify input is not null, whitespace or integer? -

i have next code verifying text boxes not null, working great. else have add together verify not whitespace or contain integers?

function verifydados() { function nullcheck() { var x = $(".dadosdotutor"); var i; (i = 0; < x.length; i++) if (x[i].value === '') { homecoming 0; } } if (nullcheck() === 0) { alert ('você ainda não tenham completado o preenchimento da tabela dados tutor. faz favor, verifique que você respondeu cada pergunta e submeter mais uma vez.'); }

note: whitespace issue, tried adapting "str = jquery.trim(str);" type solutions found trying research topic, couldn't them either travel through array, or work unknown reason.

thanks help

you'll want trim input , check against "" see if it's got stuff in it, utilize string.match(/\d+/g); see if contains number.

javascript arrays validation null whitespace

Comments

Popular posts from this blog

java - How to set log4j.defaultInitOverride property to false in jboss server 6 -

c - GStreamer 1.0 1.4.5 RTSP Example Server sends 503 Service unavailable -

Using ajax with sonata admin list view pagination -