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

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

and still the error

Figured it out… Forgot to add the prototype.js