126
rated 0 times
[
133]
[
7]
/ answers: 1 / hits: 21541
/ 9 Years ago, tue, july 28, 2015, 12:00:00
I need to remove a script tag (<script>...</script>
) by its content and/or its src property. Taking as example this:
<script type=text/javascript>
var adfly_id = 2776246;
</script>
<script src=https://cdn.adf.ly/js/display.js></script>
I've tried this code:
jQuery(document).ready(function($){
$('script').each(function() {
if (this.src === 'https://cdn.adf.ly/js/display.js') {
$(this).remove();
}
});
});
But without success (I am using that code from within WP - if anyone is asking why that jQuery syntax), can any give me some advice?
EDIT: The idea here is remove the script to prevent its execution
More From » jquery