How to remove HTML tags from a string in JavaScript

preview_player
Показать описание
In this tutorial, we'll take a look at some techniques you can use to remove unwanted HTML from user input.

The idea behind these techniques is that you want to save some user input that may have HTML tags inside it, for example, if your app has a rich text editor. However, you want to make sure the user doesn't provide any malicious content that may harm and affect other users.

I'm taking the point of view that your app will be a single page app that needs to dynamically insert content into the page using innerHTML or something similar with JavaScript.

#javascript #webdevelopment Channel Handle @codebubb
Рекомендации по теме
Комментарии
Автор

I'll be doing a video on schema validation next week to follow this up!

codewithbubb
Автор

This video was absolutely fantastic!

I liked, subscribed, and here's a comment.

But now I'd like to suggest a video, if I may?

Forgive the length, I feel it's necessary because of the sheer number of people who answer a similar or related question, which somehow sidesteps the original question altogether..

How about a video about the use of Selection and Range that allows us to "toggle" a tag around the selection? I get that we can add a tag, possibly with surroundContent, but how might we take it away afterward? The surroundContent functionality is one-way, as it should be. But what's the inverse of that?

As an example: if I have an `Absolutely <em>fantastic</em> sentence with <em>multiple</em> uses of a <em>single tag</em> within, ` then how might I be able to select whichever tag I'd like?

Us beginners don't even know how to ask the question, apparently. But that's one question I keep having zero luck with (after a year of asking around). I hope it's clear enough.

VishwaJay
Автор

Hi! How can I get a sound effect to play when I hover over a specific word? I just started learning CSS/HTML

euphoricwolf
join shbcf.ru