Active Scaffold and JRails/jQuery

To use Active with scaffold with JRails you have to use a different

JQUERY_VAR than $

In our controllers


1.  set
ActionView::Helpers::PrototypeHelper::JQUERY_VAR = ‘jQuery’

or
ActionView::Helpers::PrototypeHelper.const_set(:JQUERY_VAR, 'jQuery')

2.  in your layout load both prototype and jquery

<%= javascript_include_tag ‘prototype’, ‘effects’, ‘jquery’ %>

3. Lastly, make sure to tell jQuery to not conflict with Prototype over $ in your Javascript:

application.html.erb
  <script type="text/javascript">
      jQuery.noConflict();
    </script>



Now, you should use "jQuery()" instead of "$()".

eg:
jQuery("#id").hide()


http://errtheblog.com/posts/73-the-jskinny-on-jquery

你可能感兴趣的:(JavaScript,java,html,jquery,prototype)