Prototype problem with replace

Posted by xain on Stack Overflow See other posts from Stack Overflow or by xain
Published on 2010-04-11T19:20:48Z Indexed on 2010/04/11 19:23 UTC
Read the original article Hit count: 208

Filed under:
|

Hi, in my html page, I have the following:

<div id="rub">
    Select at least one Rub
</div>

In the script code, I have

if ( some condition ... )
  $('rub').replace("Rubs selected:");

Which works fine, but when a second event is triggered, in the code I have

if ( some other condition ... )
  $('rub').replace("Selected at least one item:");

That gives the error

 $("rub") is null

It's as if the rub reference was lost after the first replace. (Also tried with Element.replace with the same result)

Any clues ? Thanks in advance.

© Stack Overflow or respective owner

Related posts about prototype

Related posts about replace