title: rjs type error in rails?
body: <p>I add a <code>link_to_remote</code> to load a modal dialog box from a partial. But when I run the application I get the following error..</p>
  
  <pre><code>RJS error:
  
  TypeError: $("create_event_dialog").dialog is not a function
  </code></pre>
  
  <p>When I click ok then again I got another dialog box.</p>
  
  <pre><code>Element.update("create_event", "&lt;form action=\"/countries\" class=\"new_country\" id=\"new_country\" method=\"post\" onsubmit=\"new Ajax.Request('/countries', {asynchronous:true, evalScripts:true, parameters:Form.serialize(this)}); return false;\"&gt;&lt;div style=\"margin:0;padding:0;display:inline\"&gt;&lt;input name=\"authenticity_token\" type=\"hidden\" value=\"qWXCu2zMmlMhJG+GRf35kMbAIfzYAtFBee142ThmmMw=\" /&gt;&lt;/div&gt;\n &lt;p&gt;\n    &lt;label for=\"country_name\"&gt;Name&lt;/label&gt;&lt;br /&gt;\n    &lt;input id=\"country_name\" name=\"country[name]\" size=\"30\" type=\"text\" /&gt;\n  &lt;/p&gt;\n  &lt;p&gt;\n    &lt;input id=\"country_submit\" name=\"commit\" type=\"submit\" value=\"Create\" /&gt;\n  &lt;/p&gt;\n&lt;/form&gt;\n");   
  $('create_event_dialog').dialog({
      title: 'New Event',
      modal: true,
      width: 500,
      close: function(event, ui) { $('create_event_dialog').dialog('destroy') }
  
  });
  </code></pre>
  
  <p>Why do I got this kind of error? I have a div with the id of <code>create_event_dialog</code>. I am using Prototype and I could not find the way to solve this. Please help me.</p>