Я играю вместе с этим фрагментом, чтобы удалить точки останова (<br/>
) и обернуть мой текст в пунктах:Включить гиперссылки <a> в JQuery .content
$('.articleText').contents().filter(function() {
return this.nodeType == 3;
}).wrap('<p></p>').end().filter('br').remove();
Источник: http://api.jquery.com/contents/
Проблема в том, что в моем тексте содержится гиперссылка(), которая не включена в абзац, это просто отсутствует.
Это мои тексты:
Lorem Ipsum is simply dummy text of the printing and typesetting industry. <br/><br/>Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a <a href="#">galley</a> of type and scrambled it to make a type specimen book.
это, как она трансформируется:
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.</p>
<p>Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a</p>
<a href="#">galley</a>
<p>of type and scrambled it to make a type specimen book.</p>
и это, как это должно быть:
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.</p>
<p>Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a <a href="#">galley</a> of type and scrambled it to make a type specimen book.</p>
Как это возможно ...?
Не повезло - произошла ошибка в моей разметке, которая теперь исправлена ... - мой вопрос в основном: «Как я могу обернуть оба текста и ссылки в том же абзаце ...?» - Пока моя ссылка выходит за рамки абзаца ... –