Try using the noConflict setting
<script type="text/javascript">
//define function to be executed on document ready
var $j = jQuery.noConflict();
$j(function(){
$j("#user_name").validate({
expression: "if (VAL) return true; else return false;",
message: "Please enter the Password"
});
});
</script>
On Jun 2, 8:06 am, Manivannanj Jeganathan
<li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org>
wrote:> I have used Ajax link and live validation in index.rhtml
> Ajax link requires JavaScript "prototype" and live validation
requires
> "jquery".
> i got "element.dispatchEvent is not a function" on the firebug
console
> when i used "prototype" and "jquery" in same page
index.rhtml
> after i removed javascript "prototype" library, i got "Ajax
is not
> defined" on the firebug console when i clicking ajax link.
> how can i use both ajax and jquery in the same page?
> Can anybody give me a solution for this?
>
> For example:
>
> <%=javascript_include_tag "prototype"%>
> <%=javascript_include_tag "jquery"%>
> <%= javascript_include_tag
''livevalidation/jquery.validate'' %>
> <%= javascript_include_tag
''livevalidation/jquery.validation.functions''
> %>
> <%= stylesheet_link_tag
''livevalidation/jquery.validate'' %>
> <%= stylesheet_link_tag ''livevalidation/style'' %>
>
> <%=link_to_remote "new
user",:url=>{:action=>:a},:update=>"div"%>
> <div id="div"></div>
> <% form_for(@user) do |f| %>
> <p>
> <%= f.label :name %><br />
> <%= f.text_field :name %><br />
> </p>
> <p>
> <%= f.submit "Register"%>
> </p>
> <% end %>
> <script type="text/javascript">
> jQuery(function(){
> jQuery("#user_name").validate({
> expression: "if (VAL) return true; else return false;",
> message: "Please enter the Password"
> });});
> </script>
> --
> Posted viahttp://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.