javascript - Radio Button, Text Area and Input check -


i have form input fields class item. when click submit, checks, following function if values filled in.

$.each($(".items"),function(i,e){     // loop through items     if(e.value == "" || !$("input[name='"+e.name+"']:radio:checked").length)         if(error.indexof(e.title) === -1)             error += e.title + "<br/>";     }); 

this form comprises of text areas, radio boxes , normal text input fields. returns radio boxes not filled in, text inputs not filled in. returns text areas, regardless of whether it's filled in or not.

i first thought because specified check value, seems value check in fact check text areas, can't that.

could assist me in making return empty elements?

$.each( $( '.items' ), function() {     if ( ( this.type === 'checkbox' || this.type === 'radio' ) && !this.checked ) {         // go     }     else if ( this.value === '' ) {         // stuff     } }); 

unfortunately, seems there no other choice separate cases.


Comments

Popular posts from this blog

jquery - Invalid Assignment Left-Hand Side -

javascript - Preserving URL fragment through CAS sign-on -

asp.net mvc - Implementing normal user/pass, Twitter & Facebook auth -