首页 > 其他分享 >2022-11-15 如何给rich-text里的标签添加类名

2022-11-15 如何给rich-text里的标签添加类名

时间:2022-11-15 10:15:24浏览次数:38  
标签:11 15 rich title 标签 replace 2022 text 类名

e.title = e.title.replace(/\<p/gi, '<p style="display: inline-block !important"');

我这个是遍历一个数组中的所有title,并且给每个title的值都替换掉指定的标签,需要使用到replace和正则。

直接在替换值里面写样式或者类名,注意类名需要加上!important。

如果你是为了不换行,可以把p标签替换成span即可,如:

e.title = e.title.replace(/\<p/gi, '<span');

 

标签:11,15,rich,title,标签,replace,2022,text,类名
From: https://www.cnblogs.com/iuniko/p/16891479.html

相关文章

  • LeekCode415--LeekCode415
    此题出现在 BIGO的2面中原题https://leetcode.cn/problems/add-strings/solutions/357938/zi-fu-chuan-xiang-jia-by-leetcode-solution/题解1publicclassLeekC......
  • CentOS8.4(Anolis 8.6) Apache 2.4 Web 服务器配置记录(2022.11)
    1.首先安装nginx,因为目前nginx在Web服务市场的占比(26.51%)已经超过Apache(21.40%)。  2.安装nginx步骤(在阿里云虚拟主机CentOS8.4 123.56.43.47中安装)#yum......
  • Visual Studio 2022 QT 开发环境配置
    VisualStudio2022QT开发环境配置目录VisualStudio2022QT开发环境配置0.准备工作1.安装与配置0.准备工作操作系统环境:Windows10/11预备软件:序号软件名......
  • F2F-L8U3-Describing our job skills 20221113
    Areyoureadyforyourdreamjob?Findthewordsorphraseswiththemeaningsbelow.ffAvailableJOBS......
  • GL-Keeping Fit 20221114
    Lookattheadsforexerciseequipment.whichdoyouthinkisthebestbuy?Why?YogaMatforpush-upBecauseit'stoocoldtodopushupsdirectlyonthegro......
  • 11月15日
    いつだって人は鈍感だもの,毕竟无论何时人都是迟钝的,わかりゃしないんだ肚の中,理解不了别人心怀中的想法,それでも愛し愛され,却也得知在爱与被爱中活下去,生きて行くのが定......
  • F2F-Dealing with travel delays 20221113
    What'stheworstexperienceyou'vehadwhiletravelling?Describewhathappened.Discusswithapartnerplanetimedelaytraindelay因为疫情的问题我不能回家......
  • kali2022忘记密码
    1.重启客户机,按e键进入启动前编辑命令2.在Linux行尾添加rwsingleinit=/bin/bash3.Ctrl+x导入命令界面,输入passwdroot之后更改密码成功后重启客户机TRANSL......
  • GL-Speaking American 20221112
    Quinn-ChinaXingwei-ChinaAlice-ChinaEistert-ChinaFen-ChinaAaron-ChinaWhatdoamericansoundlike?Thespeedofcontinuousreadingwillbefastertha......
  • GL-Facing a challenge 20221115
    Time2022.11.14Monday23:30-00:15TopicFacingachallengeWhatisthehardestthingyou'veeverhadtodo?howdidyoumanagetoovvercometheobstaclesin......