jquery - how to change my innerHTML from < to &lt; -


i'm trying access inner html source , want change < , > &lt; , &gt; respectively,though went run code browser did render want when edit source code see &lt;div&gt; instead of <div> while on screen see <div>, want code posted on site.

$('.test1').html($('.test1').html().replace(/</g, '&lt;').replace(/>/g, '&gt;')); 

the above stop browser rendering code html , display code on screen in source code instead of <div> shows <div> if


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -