We help IT Professionals succeed at work.

find blank text field and change css class with jquery

tomcattyy
tomcattyy asked
on
553 Views
Last Modified: 2012-05-08
Hello everyone,
I am trying to find empty field within a form and change the class of a empty one with jquery. My code below will add new css to all fields not just the blank one, Please correct my syntax.

Thanks
$('#client input').each(function(){
if ($('input:text').val().length==0){
//alert($('this input').val()); 
$(this).addClass("Needvalidate")
}
}) // end of each

Open in new window

Comment
Watch Question

Top Expert 2009
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
Thanks, it surely worked.

Author

Commented:
Quick and clear
Top Expert 2009

Commented:
thanks for the grade and points.
have a pleasant evening.

Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.