AnsweredAssumed Answered

How to clear textarea on click using AMD syntax

Question asked by schlot on Oct 8, 2013
Latest reply on Oct 8, 2013 by btfou
I have a textarea that starts out as
        <textarea data-dojo-type="dijit/form/Textarea" id="taAddress"/>Enter an Address, Place or ZIP.</textarea>


I'd like for the user to be able to click on the phrase "Enter an Address, Place or ZIP", and have that automatically empty the textarea so the user can just start typing without having to delete the phrase already in there.

I have a line which I've placed below my last function, but before the ending });
registry.byId("taAddress").on("click", clearTextInput('taAddress'));


and here's my function:
function clearTextInput (textFieldName) {     var txtarea = registry.byId(textFieldName);     txtarea.set("value", ""); }


My problem is that this fires as the page is loading, not on the map click.  I can see it starts out with my initial phrase, but then it clears itself, even before I have a chance to actually click in the textarea.

Outcomes