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 <[email protected]>
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to