Jquery select first letter?

后端 未结 5 1201
时光说笑
时光说笑 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:43

    To hide the

    tags whose text does not start with the letter B:

    $('p').filter(function() {
      return $(this).text().charAt(0).toUpperCase() != 'B';
    }).hide();
    

提交回复
热议问题