Hi!
I figured it out, in case anyone is interested. Instead of using 
setAttribute on the element, I had to use this.nextSibling.firstChild.src, 
because the image is the first child of the next sibling of the textarea. 
Same for title and alt. The setAttribute approach worked in pure HTML file 
though.

w

On Thursday, October 23, 2014 3:58:21 PM UTC+2, whatever wrote:
>
> Hi!
>
> I'm trying to add preview to my InfoboxTablesPlugin (1). Basically, if 
> you change the image in edit mode, the preview beneath the textarea where 
> you enter the new URL would show the new picture. The plugin generates HTML 
> output, so the code needs to be inserted there. Currently this is my 
> onchange handler, where imageID is the ID of the img tag:
> onchange=\"this.defaultValue = this.value; document.getElementById('" + 
> imageID + "').setAttribute('src',this.value);\"
>
> DOM structure:
> <div>
> <textarea with the onchange handler></textarea>
> <div for preview>
> <img for preview>
> </div for preview>
> </div>
>
> When I added an alert at the end, it showed the new URL (interestingly, 
> console.log showed nothing), but the image didn't change. How do I push the 
> changes to the image? I suspect I need to refresh something, but I'm not 
> sure what or how. Or do I need to push the changes (the entire new img tag 
> with the new URL) to the "div for preview"?
>
> I've set up a test (2).
>
>
> (1) http://infoboxes.tiddlyspot.com
> (2) http://infoboxestest.tiddlyspot.com/
>
> w
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.

Reply via email to