Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我试过:
$('span.tag').each(function(){ $(this).attr('title', '').prop('title', function(){$(this).children('li:first').text();}); });
为什么这么复杂?这很简单
$('span.tag').each(function(){ $(this).attr('title', $(this).find('li:first').text()); });
试试这个:
$('span.tag').attr('title', function(){ return $(this).find('li:first').text(); });