I have some table rows
-
var a_href = $('div.cpt').find('h2 a').attr('href');
should be
var a_href = $(this).find('div.cpt').find('h2 a').attr('href');
In the first line, your query searches the entire document. In the second, the query starts from your tr
element and only gets the element underneath it. (You can combine the find
s if you like, I left them separate to illustrate the point.)
- 热议问题