Js.erb render html string

Hi,

I have an action that renders a simple text:

text.js.erb
modal.find(’.modal-body’).text(’<%= @text.content %>’);

This content variable contains a string with some html tags.
But these tags aren’t displayed correct.
I tried to use raw, html_safe, etc
But nothing worked.

How can I display the content with html tags formated ?

example: my text

my text

Thanks.

You should use method .content() instead of method .text()

Gosh, I mean method .html() instead of method .text()

On Wed, Apr 22, 2015 at 9:25 PM, Vladimir Gordeev <

I owe a donut to you.
Thank you man.

You’re welcome.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs