I am using the following html
<div id="chatid" name="1">
<img src="http://placehold.it/50/55C1E7/fff" alt="User Avatar" class="img-circle" /> John
</div>
<div id="chatid" name="2">
<img src="http://placehold.it/50/55C1E7/fff" alt="User Avatar" class="img-circle" /> James
</div>
I am using the following jquery script
$(document).ready(function() {
$("#chatid").click(function() {
thread = $(this).attr('name');
$("#chatmessages").load('fetchmessages.php?id=' + thread);
//alert($(this).attr('name'));
return false;
});
});
This only gives the name when clicking on the first "chatid" Div, is there a way for me to return the name of any "chatid" Div?
Thanks