The problem with adding plugin
or video URLs to my website is that the video content of the URLs or the Plugins generates external links to another website, so I wanted to try to see if I jQuery
could prevent these links from being generated.
The idea is to comment the links <!-- -->
or remove them but not all, you could create a condition that all links that do not have the id="nobloquear"
comment or remove them using jQuery
I'm not very proficient in jQuery very basic knowledge.
The only thing that has been achieved is to be able to eliminate a specific content of the document of the page, that is, the content of the class .delete
eliminates only if there is a word or a specific content in this example it will be the word hello .
$( ".delete" ).remove( ":contains('Hello')" );
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div>
<div class="delete">Hello</div>
<div class="delete">No se elimina porque este div no existe la palabra hola en inglés, a pesar de ser la misma clase .delete</div>
</div>
This example doesn't really delve into my idea, which is to remove or comment out the links that the class doesn't have:
class="nobloquear"
Could you help me
There can't be more than one element with an id, let's use the class
nobloquear
for exceptions.Delete all
<a>
that do not have a class:Comment out all
<a>
that don't have a class:It doesn't make much sense this way, comments are part of the HTML, not the DOM. It would be done: