0

In embedded ruby(html.erb) file,

I have a string of html like variable_string = "<p>Some <strong>Content</strong></p>".

Using Javascript we can just update DOM like Element.innerHTML = variable_string and the string will be rendered as html.

But I can't use JavaScript and want to do something like

<div innerHTML="<%= variable_string %>"> 

directly sort of inline way. Is it possible?

MAK
  • 123
  • 1
  • 9

1 Answers1

0

string.html_safe and other approach is ActionView::Helpers::SanitizeHelper

MAK
  • 123
  • 1
  • 9