I am trying to use the jQuery validation plugin to validate my form but cant get it working. I have the script types in the header:

<script type="text/javascript" src="/jquery-1.4.2.min.js"></script>
	<script type="text/javascript" src="/jquery.validate.js"></script>

And my Form:

<form id="taskentry" method="post">				
				Trip Date<input type="text" class="required" name="trip[Date]" id="tripDate" placeholder="MM/DD/YYYY"/></form>

I tried this but not working:

<script>
		$("#taskentry").validate({
			rules: {
				tripDate: {required: true}
			}
		});
	</script>

How do I implement the validation plugin to use on my form?

Thank You

Don't know about the plugin, but "trip[date]" is an expression, not a name.

hello friend i have a very simple and easily JQ plugin for you.All you have to do is to include it on your page and change as you want and only changing the textfield id name are required and as much textfield you want to validate you can do this by changing the name in the below plugin as i mention there.not only this but you can increase by adding as many if condition for you textfields for validating.

<script type="text/javascript">
    $(document).ready(function(){
						 
	$("#submit").click(function(){
	
			var show = $("#put textfield number 1 id here").val();
			var show2 = $("#put textfield number 2 id here").val();

			if(show==""){
			
				$("#put textfield number 1 id here").css('border','1px solid #A92149');
			
				}
				
				if(show2==""){
			
				$("#put textfield number 2 id here").css('border','1px solid #A92149');
				return false;
				}
								
});					   
		  $("#center").click(function(){
																															                     var show = $("#put textfield number 1 id here").val();
					 var show2 = $("#put textfield number 2 id here").val();
								   
					 if(show!="" )
						   {
					 $("#put textfield number 1 id here").css('border','1px solid #999');
							   
						   }
						   
						     if(show2!="")
						   {
							   
					 $("#put textfield number 2 id here").css('border','1px solid #999');
							 }
		
});			   						   
});

</script>
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.