There are blocks
<div><h1>Текст заголовока</h1></div> <div><h1>Текст заголовока<b> жирный текст</b></h1></div> I want to ensure that a text class is added to each text tag.
Text tag is a tag that has only text value, maximum icon <i>
My code is:
$(':not(:has(*),:empty)').addClass('text'); It works only for the first h1 , but for the second it adds only to the tag b. How to improve the jquery sample in my example? I also want to clarify that tags can be any like a span or p, not the essence) Thanks in advance!
$("h1").addClass('text');- Grundy<b>it is not<i>therefore it works the way you want - Grundy