I'm using Element.update inline to modify the contents of a textarea.
If the updated text doesn't contain any html it works fine. For
example the following code works and updates the text area with the
simple text of small, medium, or large.

<div onclick="Element.update('code_text', 'Small')">Small</div>
<div onclick="Element.update('code_text', 'Medium')">Medium</div>
<div onclick="Element.update('code_text', 'Large')">Large</div>
<textarea id="code_text" cols=75 rows=2><img src="/images/small/
sample.jpg" /></textarea>

However, I'm trying to make the textarea update with the code for an
image tag. The following is what it seems like I should do.

<div onclick="Element.update('code_text', '<img src="/images/small/
sample.jpg" />')">Small</div>
<div onclick="Element.update('code_text', '<img src="/images/medium/
sample.jpg" />')">Medium</div>
<div onclick="Element.update('code_text', '<img src="/images/large/
sample.jpg" />')">Large</div>
<textarea id="code_text" cols=75 rows=2><img src="/images/small/
sample.jpg" /></textarea>

If I do this, the end of the image tag closes the div tag and the page
looks like this:
')">Small
')">Medium
')">Large

Any ideas?

-- 
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.

Reply via email to