validate: function () {
			contact.message = '';
			if (!$('#contact-container #contact-name').val()) {
				contact.message += 'Name required. ';
			}
			if (!$('#contact-container #contact-phone').val()) {
				contact.message += 'Phone required. ';
			}
			[B]if (!$('#contact-container #contact-phone').length()<>10) {
				contact.message += 'Phone no should be of 10 digit. ';
			}[/B]
			var email = $('#contact-container #contact-email').val();
			if (!email) {
				contact.message += 'Email required. ';
			}
			else {
				if (!contact.validateEmail(email)) {
					contact.message += 'Invalid email ';
				}
			}
             
            
			if (!$('#contact-container #contact-message').val()) {
				contact.message += 'Msg required.';
			}
			

			if (contact.message.length > 0) {
				return false;
			}
			else {
				return true;
			}
			
		},
Member Avatar for stbuchok

What value is it giving you? Does it say undefined? Also, don't use double negatives.

if ($('#contact-container #contact-phone').length() === 10) {
	contact.message += 'Phone no should be of 10 digit. ';
}

//however I think you actually meant this
if ($('#contact-container #contact-phone').length() !== 10) {
	contact.message += 'Phone no should be of 10 digit. ';
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.