I donβt understand why attr () is called only once,
my html
<table id="myTable"> <tbody> <tr> <td>...</td> <td>...</td> <td> <abbr title='first'>Demo1</abbr> </td> </tr> <tr> <td>...</td> <td>...</td> <td> <abbr title='second'>Demo2</abbr> </td> </tr> . . . </tbody> </table>
now I want to get the "title" from all abbr , so I wrote the following query
$(document).ready(function () { console.log($('#myTable tr td:nth-child(3) abbr').attr("title")); }
So he must give me back
first second . . .
but the output is only "first" ,
but if you write
var oRows = $('#myTable tbody tr'); $.each(oRows, function (i) { console.log($(this).children('td:nth-child(5)').children().attr("title")); });
then I get the correct conclusion. but I donβt think this is the right approach, so any body, please tell me where I am wrong.
I also read this answer, but still I am not clear
thanks
source share