Jquery select first letter?

后端 未结 5 1180
时光说笑
时光说笑 2020-12-31 05:24

I am simply attempting to get jquery to identify the first letter of a paragraph. How would I do this?

For example, I have a page with a number of paragrahs on a pa

5条回答
  •  礼貌的吻别
    2020-12-31 05:29

    $('p').hide().filter(function(){return $(this).text().match(/^b/i);}).show();
    

    or indented

    $('p').hide()
          .filter(
                  function(){
                             return $(this).text().match(/^b/i);
                            }
                 )
          .show();
    

    remove the i in the match if you want it to be case sensitive..

    and you can look at http://jquery-howto.blogspot.com/2009/09/get-url-parameters-values-with-jquery.html on how to get the url parameters..

提交回复
热议问题