HTML:
<div class="abc">
<span data-rel="hai">Hello</span>
<span data-rel="bye">Bye</span>
</div>
jQuery:
$(document).on('click','.abc >span',function(){
alert(($(this).attr('data-rel'))); // This Code alerts hai.
alert($('.'+($(this).attr('data-rel'))+'_cls')); // I thought this code would alert as .hai_cls but it alerts as [object object].
});
我能知道这些之间的区别吗?