These are chat archives for ipython/ipython

27th
Jun 2016
Stuart Nelson
@sutartmelson
Jun 27 2016 17:06
@minrk, @xerxes455 and I have some javascrip/html that runs as expected when using %%html, but whenever we attempt to use the display(HTML("")), it doesn't work.
Min RK
@minrk
Jun 27 2016 19:45
@sutartmelson that's bizarre. Can you share an example?
This is the html magic. It really is nothing more than display(HTML(cell))
So I have to assume that something is getting funky (perhaps escapes?) in the
manual version.
Stuart Nelson
@sutartmelson
Jun 27 2016 19:55
Its using jquery. We're working on a quick repeatable example to share.
Min RK
@minrk
Jun 27 2016 20:24
Have you tried reversing the order of the cells?
If you do that, does the magic cell fail and the non-magic one succeed?
You are attaching autocomplete to $('#tags'). That's attaching it to the one and only element on the page with id='tags'.
But both your cells are creating this element, so you have two items with the same id, which you shouldn't have.
Since the page assumes there's only one, it always finds just the first one (or fails if there's more than one).
If you make the id distinct (tags1, tags2), it should work in both cases.
Stuart Nelson
@sutartmelson
Jun 27 2016 20:30
Oh I see. Neither of us know anything about js so we completely overlooked that.
When we switch the order like you said, exactly what you expected to happen happened :)
Min RK
@minrk
Jun 27 2016 20:30
You also don't want to add <body> tags to outputs. There should only be one body per page.
Adam Sorensen
@adsorensen
Jun 27 2016 20:44
@minrk we are trying the same thing with our actual code and it still isn't working with the display(HTML(cell)). We have a callback that is constantly updating the suggestions with every key press, could that affect it?
Min RK
@minrk
Jun 27 2016 21:07
Possible. Is there only once instance on the page?
Adam Sorensen
@adsorensen
Jun 27 2016 21:11
Yes