How to apply css to only numbers in a text inside/or any

element?

前端 未结 5 971
日久生厌
日久生厌 2020-12-06 02:39

I am Using a Regional language unicode font-face in my site but the numbers are not looking good.

So I want to apply new font-style or css to numbers only..

5条回答
  •  一个人的身影
    2020-12-06 03:21

    You can use the regex replace and detect the numbers then add the class

    following code:

    $('p').html(function(i,c) {
        return c.replace(/\d+/g, function(v){
        return "" + v + "";
        });
    });
    .numbers
    {
    color:red;
    font-size:30px;
    }
    
    

    View 11 new out of 11 message(s) in your inbox

提交回复
热议问题