alechill / livevalidation

Open source javascript library for slick, powerful, and easy client-side validation.
http://livevalidation.com
Other
151 stars 57 forks source link

validation not working when calling jQuery #10

Open wjrichardson opened 12 years ago

wjrichardson commented 12 years ago

Have you noticed any issues with jQuery? When I reference jQuery in the head of my page the validation does not work. When I remove the reference it works great. I'm using jQuery for a slider on my homepage. Are there any tips or quirks that I should be aware of when using the two (jQuery and livevalidation) together?

mcordingley commented 12 years ago

I'm using the two of them together and haven't found any issues. Can you provide code samples from your page?

wjrichardson commented 12 years ago

Yeah, I'll post some later tonight. I tried to this morning but was having some issues with how the code was displaying. Thanks!

mcordingley commented 12 years ago

OK, I see one red flag off the bat. You're including both Prototype and jQuery. They both like to use $() as their main entry-point, so you may have a conflict going on right there. Given that you have scriptaculous and the prototype version of livevalidation, I'm guessing that you're mainly using Prototype and that jQuery was pulled in solely as a dependency.

Try doing these two things, which should fix your issue when done together:

  1. Open your copy of jQuery and insert a new line at the bottom of it: jQuery.noConflict();
  2. Wherever you use FlexSlider, change $('someselector').flexslider(); to jQuery('someselector').flexslider();

The first change will keep jQuery from taking over the $() function, leaving Prototype to function properly. The second will keep those calls to your jQuery plugin calling jQuery instead of Prototype. Hope that helps!

wjrichardson commented 12 years ago

You sir, are a gentleman and a scholar!

mcordingley commented 12 years ago

You're welcome. :D Glad to help.