craigsworks.com - Support Forum

Full Version: [Solved] Style Update on validation
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi
How can i update the style and contents of the qtip?
I have this script for normal qtip on pageload.

JS Code
$(document).ready(function(){
			$(".text-input").qtip({
   content: "enter correct values",
   position: {
					      corner: {
							 target: 'rightMiddle',
					         tooltip: 'leftMiddle'
					      }
					   },
					   style: {
						  tip: true,
					      name: 'green'
					   }
});
			$("#order_form").validate(
			);
		});


On submitting form, this script runs and updates the content, at the same time i want to update the style to red and qtip has to stay on the page.
JS Code
jQuery.validator.setDefaults({
			    errorPlacement: function(error, placement) {
					$(placement).qtip('api').updateContent(error.text());
				}
			});


what changes i need to make in the above code for that?
JS Code
jQuery.validator.setDefaults({
	errorPlacement: function(error, placement) {
		$(placement).qtip('api').updateContent(error.text()).updateStyle('red');
	}
});
Reference URL's