• 04giu

    Your remote_function or remote_form_tag could stop working if you use jQuery into your Ruby on Rails project. This is because the jQuery $ function is different from the prototype one, and RoR uses some particular function that is not available with jQuery.

    For example, you can get an error like this submitting your remote_form_tag:

    $(form).getElementsByTagName is not a function
    http://localhost:3000/javascripts/prototype.js?1239274532
    Line 3483

    To solve this kind of problem, you have to use the jQuery no-conflict method, like explaned on the jQuery site. Simply add theese lines of code in your default layout between into a <script> tag:

    jQuery.noConflict();
    jQuery(document).ready(function($) {
    })

    Now, RoR can use prototype calling the default function $ and you can use jQuery using the jQuery function:

    jQuery("#myId").hide("def");

    Tags: , , , ,

   

Recent Comments

  • It's very strange, you're right... The code seems to be ok....
  • it is using its default renderer.. ...
  • I'm sorry but I cannot understand. If you have commented out...
  • hi, am also having this ghost image problem.. problem is tha...
  • Ok, I think I could elaborate on that =) Take this method: ...