# Help with replaceSel/replaceText

**URL:** <https://forum.kirupa.com/t/help-with-replacesel-replacetext/217786>\
**Category:** Uncategorized\
**Created:** [March 1, 2007, 9:07pm UTC](https://forum.kirupa.com/t/help-with-replacesel-replacetext/217786 "2007-03-01T21:07:48Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ad0ac](https://avatars.discourse-cdn.com/v4/letter/a/e9bcb4/32.png) [@ad0ac](https://forum.kirupa.com/u/ad0ac)\
**Post date:** [March 1, 2007, 9:07pm UTC](https://forum.kirupa.com/t/help-with-replacesel-replacetext/217786/1 "2007-03-01T21:07:48Z")

</div>

I’m currently using replaceSel to insert HTML tags in a block of text, and i’ve got it working fine with a standard textbox. My issue is that it doesn’t seem to work with a textArea component. Is this a bug or am I missing something. Here’s the code (adapted from the flash help file):

var my\_cm:ContextMenu = new ContextMenu();  
my\_cm.customItems.push(new ContextMenuItem(“Enter current date”, enterDate));  
function enterDate(obj:Object, menuItem:ContextMenuItem) {  
textBox.replaceSel("\<br\>");  
}  
textBox.menu = my\_cm;

Where “textBox” is the instance name of either a textBox or textArea component.

Thanks for any help you can provide.
