Closed firedev closed 9 years ago
Hi @firedev,
Can you try this ?
Turbolinks.replace('<div id="id" data-turbolinks-temporary>hello</div>', {change: ['id']});
Cheers, Tortue Torche
Okay I see now.
But still, I need to replace <td>
and it works only with <div>
. Is it by design?
For replacing a <td>
, you can do that:
Turbolinks.replace('<table><tr><td id="my_id">hello</td></tr></table>', {change: ['my_id']});
Because Turbolinks need a well-formed HTML fragment.
Thanks I'll try in the morning. But this means I need to add another view around my td
just to render it from Turbolinks.
Kind of defeats the purpose.
I don't think that replacing the DOM content with a HTML fragment is the main goal of Turbolinks.replace()
.
You should have an entire HTML page in the first argument of Turbolinks.replace()
, not a fragment of it.
Maybe jQuery UJS is more appropriate for what you want to do...
In fact I am rendering this from the controller. And yes I am replacing js.erb
partial with render change
. But it happens that I can render only part of the view.
I have html that looks correct to me:
No errors in console:
But nothing changes: