$(‘#message_holder’).append(‘
The string gets appended to the message_holder div like so:
<div class="container"><span class="right">9</span><br></div>
but the styling defined in .right doesn't get applied What to do?
$(‘#message_holder’).append(‘
The string gets appended to the message_holder div like so:
<div class="container"><span class="right">9</span><br></div>
but the styling defined in .right doesn't get applied What to do?
there are a massive number of possible reasons. you really should do some research on css display types, as I’m assuming right
is supposed to be a element with “float: right” but “span” tags don’t respond to floats unless they have been set as block-level elements
view:
<% @messages.each do |m| %> <% if m.sender==@conversation_with.id %>
<% end %>
js:
received(data) {
if (data.sender==$('#message_holder').data-conversation_with_id)
{
$('#message_holder').append('<div class="container-left">' + data.content + '</div>');
}
else
{
$('#message_holder').append('<div class="container-right">' + data.content + 'converation_with_id:' + '</div>');
}
} });
Actually I think my problem is in the content_tag in my view I could rewrite it as html but I may as well get this right the rails way Presently the problem is data-conversation_with_id isn’t being passed to the javascript