RJS Error: Element.update is not a function

Hi,
I have implemented some RJS code and I have the same exact code in 2
different places. In one place I get the error "Element.update is not
a function" and the other place works fine. Any idea why this error is
coming? Breaking my head.

-Vinod

The Javascript generated looks like:

        <div id="newpost">
          <a href="#" onclick="try {
Element.update(&quot;newpost&quot;,
&quot;&lt;head&gt;\n\n&lt;/head&gt;\n&lt;body&gt;\n\n &lt;form
action=\&quot;/video/updatepost?topic_id=51&amp;amp;amp;parent_post_id=&amp;amp;amp;divname=newpost\&quot;
method=\&quot;post\&quot; onsubmit=\&quot;new Ajax.Updater('newpost',
'/video/updatepost?topic_id=51&amp;amp;parent_post_id=&amp;amp;divname=newpost',
{asynchronous:true, evalScripts:true,
parameters:Form.serialize(this)}); return
false;\&quot;&gt;\n\n&lt;table width=100%&gt;\n \n
&lt;tr valign=\&quot;top\&quot;&gt;\n &lt;td&gt;\n &lt;span
style=\&quot;font-family: Verdana, Arial, Sans-Serif; font-size:
10px\&quot;&gt;\n &lt;textarea cols=\&quot;40\&quot;
id=\&quot;postmessage\&quot; name=\&quot;postmessage\&quot;
rows=\&quot;3\&quot;&gt;&lt;/textarea&gt;\n &lt;/span&gt;\n
&lt;/td&gt;\n &lt;td&gt;\n &lt;input id=\&quot;commit\&quot;
name=\&quot;commit\&quot; type=\&quot;hidden\&quot;
value=\&quot;Post\&quot; /&gt;\n &lt;table&gt;\n
&lt;tr&gt;\n &lt;td&gt;\n &lt;input
id=\&quot;SubmitPost_newpost\&quot; name=\&quot;_commit\&quot;
type=\&quot;submit\&quot; value=\&quot;Post\&quot; /&gt;\n
&lt;/td&gt;\n &lt;/tr&gt;\n\n &lt;tr&gt;\n
&lt;td&gt;\n &lt;input id=\&quot;DiscardPost_newpost\&quot;
name=\&quot;_commit\&quot; onclick=\&quot;Form.getInputs(this.form,
null, 'commit')[0].value = 'Discard'\&quot; type=\&quot;submit\&quot;
value=\&quot;Discard\&quot; /&gt;\n &lt;/td&gt;\n
&lt;/tr&gt;\n &lt;/table&gt;\n &lt;/td&gt;\n
&lt;/tr&gt;\n&lt;/table&gt;\n&lt;/form&gt;\n&lt;/body&gt;&quot;);
} catch (e) { alert('RJS error:\n\n' + e.toString());
alert('Element.update(\&quot;newpost\&quot;,
\&quot;&lt;head&gt;\n\n&lt;/head&gt;\n&lt;body&gt;\n\n &lt;form
action=\\&quot;/video/updatepost?topic_id=51&amp;amp;amp;parent_post_id=&amp;amp;amp;divname=newpost\\&quot;
method=\\&quot;post\\&quot; onsubmit=\\&quot;new
Ajax.Updater(\'newpost\',
\'/video/updatepost?topic_id=51&amp;amp;parent_post_id=&amp;amp;divname=newpost\',
{asynchronous:true, evalScripts:true,
parameters:Form.serialize(this)}); return
false;\\&quot;&gt;\n\n&lt;table width=100%&gt;\n \n
&lt;tr valign=\\&quot;top\\&quot;&gt;\n &lt;td&gt;\n &lt;span
style=\\&quot;font-family: Verdana, Arial, Sans-Serif; font-size:
10px\\&quot;&gt;\n &lt;textarea cols=\\&quot;40\\&quot;
id=\\&quot;postmessage\\&quot; name=\\&quot;postmessage\\&quot;
rows=\\&quot;3\\&quot;&gt;&lt;/textarea&gt;\n &lt;/span&gt;\n
&lt;/td&gt;\n &lt;td&gt;\n &lt;input id=\\&quot;commit\\&quot;
name=\\&quot;commit\\&quot; type=\\&quot;hidden\\&quot;
value=\\&quot;Post\\&quot; /&gt;\n &lt;table&gt;\n
&lt;tr&gt;\n &lt;td&gt;\n &lt;input
id=\\&quot;SubmitPost_newpost\\&quot; name=\\&quot;_commit\\&quot;
type=\\&quot;submit\\&quot; value=\\&quot;Post\\&quot; /&gt;\n
&lt;/td&gt;\n &lt;/tr&gt;\n\n &lt;tr&gt;\n
&lt;td&gt;\n &lt;input
id=\\&quot;DiscardPost_newpost\\&quot; name=\\&quot;_commit\\&quot;
onclick=\\&quot;Form.getInputs(this.form, null, \'commit\')[0].value =
\'Discard\'\\&quot; type=\\&quot;submit\\&quot;
value=\\&quot;Discard\\&quot; /&gt;\n &lt;/td&gt;\n
&lt;/tr&gt;\n &lt;/table&gt;\n &lt;/td&gt;\n
&lt;/tr&gt;\n&lt;/table&gt;\n&lt;/form&gt;\n&lt;/body&gt;\&quot;);');
throw e }; return false;">Post a new comment</a>
       </div>

I simplified the JS code to:

        <div id="newpost">
          <a href="#" onclick="try {
Element.update('newpost', 'hello');
} catch (e) { alert('RJS error:\n\n' + e.toString());
alert('Element.update(\&quot;newpost\&quot;, \&quot;hello\&quot;);');
throw e }; return false;">Post</a>
       </div>

and still the error

Figured it out.. Forgot to add the prototype.js