-1
4

1 回答 1

0

演示

$(function() {
  var text, charsLength=0,wordsCount=0;
  $('#strongdiv strong').each(function() {
    text = $.trim($(this).text());
    charsLength += text.length;
    wordsCount += text.split(/\s+/).length;
  });
  $("#output").append("words"+wordsCount+"<br/>chars: "+charsLength);
});
于 2013-05-02T21:38:29.670 回答