$('.message-container').html('');
$('input#reference-parent-typeahead').val('<%= @reference.parent.try('citation').try('html_safe') %>');
$('a#tab-heading').html('<%= @reference.citation %>');
$('#search-result-details-info-message-container').html('<%= @message %>');
$('select#reference_ref_type_id').focus();
<% unless @message.match(/^No change/) %> 
  $('a#Reference-<%= @reference.id %>').html('<%= escape_javascript(render partial: 'reference_link_text', locals: {reference: @reference}) %>');
  $('input#reference-author-typeahead').val('<%= @reference.author.try('name').try('html_safe') %>');
<% end %>

$('.message-container').html('');
$('input#reference-parent-typeahead').val('<%= @reference.parent.try('citation').try('html_safe') %>');
$('a#tab-heading').html('<%= @reference.citation %>');
$('#search-result-details-info-message-container').html('<%= @message %>');
$('select#reference_ref_type_id').focus();
<% unless @message.match(/^No change/) %> 
  $('a#Reference-<%= @reference.id %>').html('<%= escape_javascript(render partial: 'reference_link_text', locals: {reference: @reference}) %>');
  $('input#reference-author-typeahead').val('<%= escape_javascript(@reference.author.try('name').try('html_safe')) %>');
<% end %>

Update message now shows even for refs with apostrophe in citation - using escape_javascript.
Update message now shows even for refs with apostrophe in citation - using escape_javascript.
