in my rails app I'm trying to create a set of buttons that can be clicked to copy a sentence (the title of tips) which are stored in @all_tips. At the moment the copying is working but only for the first word (i.e. stops as soon as there's a space) and I'm not sure why and haven't been able to find any other guidance.
<% (@all_tips).each do |n| %>
<button class="btn btn-success copy_to_clipboard" data-clipboard-text= <%= n.title %> > <p> <%= n.title %></p> </button>
<% end %>
<script>
jQuery.fn.copyToClipBoard = function() {
var clip = new ZeroClipboard($(".copy_to_clipboard"));
}
$(function() {
$('.copy_to_clipboard').copyToClipBoard();
});
</script>
Any help would be greatly appreciated, thanks!