javascript - Error getting the .last() -
i have this structure
i want last message, im trying use .last() function:
$('#user-chat-' + data.de).find('#load-msgs').last().html()
but jquery returns results inside div, not last result. knows why im getting error? (the selector correct, im getting result, don't last) thanks!
$(document).ready(function(){ $("#load-msgs").last().find('div span').html() //or $("#load-msgs div span").last().html() })
here working fiddle
the html script :
<div class="row" id="load-msgs"> <div class="col-md-10 col-sm-12 col-xs-12 "> <span class="message-box message-other" data-toggle="tooltip" data-placement="right" title="18:28"> lewpwa </span> </div> <div class="col-md-10 col-sm-12 col-xs-12 "> <span class="message-box message-other" data-toggle="tooltip" data-placement="right" title="18:28"> oppa </span> </div> <div class="col-md-10 col-sm-12 col-xs-12 "> <span class="message-box message-other" data-toggle="tooltip" data-placement="right" title="18:36"> oppa </span> </div> <div class="col-md-10 col-sm-12 col-xs-12 "> <span class="message-box message-other" data-toggle="tooltip" data-placement="right" title="18:36"> oppa </span> </div></div>
Comments
Post a Comment