I'm trying to modify this plugin so that is counts characters rather than words.
$(function(){
    var $quote = $(".post p:first");
    var $numWords = $quote.text().split(" ").length;
    if (($numWords >= 1) && ($numWords < 10)) {
        $quote.css("font-size", "36px");
    }
    else if (($numWords >= 10) && ($numWords < 20)) {
        $quote.css("font-size", "32px");
    }
    else if (($numWords >= 20) && ($numWords < 30)) {
        $quote.css("font-size", "28px");
    }
    else if (($numWords >= 30) && ($numWords < 40)) {
        $quote开发者_JAVA百科.css("font-size", "24px");
    }
    else {
        $quote.css("font-size", "20px");
    }    
});
Here's the original post on the plugin: http://css-tricks.com/set-font-size-based-on-word-count/
Thanks!
This: $quote.text().split(" ").length
should be: $quote.text().length.
split(" ") divides the text by spaces, giving you the words. By removing this part, you count characters instead of words.
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论