Search code examples
javascriptinternet-explorerprototypejs

Prototype Element.update() function not working in IE


Using Element.update() prototype function:

[ ... ]
var link_1 = new Element('a').update( '<'  );
var link_2 = new Element('a').update( '<<' );
[ ... ]

Only in IE i'm getting:

'link_1' is not defined

How can i write the string "<" into a prototype element?


Solution

  • I would suggest using the HTML entities of those characters instead of the actual characters as they are typically the start of HTML tags.

    So instead of update("<") try doing update("&lt;")

    And update("&lt;&lt;")

    List of entity replacements