-
Notifications
You must be signed in to change notification settings - Fork 201
Open
Description
Есть вот такой html:
`
<img loading="lazy" data-aos="fade-right" data-aos-delay="100" src="/static/img/neverback-step-2.svg" alt="step-2" class="aos-init aos-animate">
<div data-aos="fade-right" data-aos-delay="200" class="aos-init aos-animate">
<h4></h4>
<ul>
<li>The Aula is made of a high-tech memory foam material with even more adaptive properties.</li>
<li>The material reacts to your weight and body temperature, conforming to the shape of your head and neck for superior comfort.</li>
<li>The safety of the materials used in our pillows has been confirmed by the international certificate OEKO-TEX®️ STANDARD 100 of the highest class 1 (certified safe from initial production).</li> </ul>
<a href="our-materials" class="button transparent">
<span>More about our material</span>
</a>
</div>
Задача: получить содержимое
и поменять классы у ссылки с button transparent на default-btn.
Что я делал:
Что я делал:
$element = $document->first('.neverback__step_text div'); $innerHTML = $element->innerHTML(); $link = $element->first('a'); $link->setAttribute('class', 'default-btn'); $linkHTML = $link->html(); $innerHTML = str_replace($element->first('a'), $linkHTML, $innerHTML);
В итоге, ссылка с изменёнными классами не заменяла оригинал, потому что при получении html методом innerHTML в нём заменяются переносы строк на
Metadata
Metadata
Assignees
Labels
No labels