Change color first word of each line with CSS or jQuery

前端 未结 2 1933
感动是毒
感动是毒 2021-01-25 01:12

Im trying to target the first word of each line to change the color to only the first word on it. Right now this is being populated by a textarea on the backend.

2条回答
  •  感情败类
    2021-01-25 01:21

    Try something like this in a loop:

     var firstWord = $(this).text().split(" ")[0];
     var newText = $(this).text().replace(firstWord, ""+firstWord +"");
     $(this).html(newText);
    

提交回复
热议问题