clipboard.js with html.erb to be copied to clipboard

I’m trying to implement clipboard.js It works if i put a simple text string inside the

containers but if I put the html shown below it copies only newline and whitespace characters to the clipboard


Is the Ruby on Rails list the best place to ask this question?

Works after changing