JQuery замена спец. символов в текста на HTML сущности - пример
Primary tabs
Следующий код заменит спец. символы на HTML сущности:
jQuery('<div />').text('Some text with <div>html</div>').html()and the output will look like
"Some text with <div>html</div>"
Чтобы раскодировать (обратная операция):
jQuery('<div />').html('Some text with <div>html</div>')Получим:
"Some text with <div>html</div>"
Взял отсюда (спасибо Игорю): http://moiseevigor.github.io/programming/2015/02/27/encode-string-to-html-entities-jquery/
- Log in to post comments
- 5879 reads