user2073143
user2073143

Reputation:

Replace string in <body> with jQuery

I'm struggling with a seemingly simple task. Working on a WP website, I have a plugin that is outputting the following string

..." />

just after the body tag. The plugin is not optional, and I'd like to hide this for the moment, until it can be fixed. So how does one find and delete that string?

I tried this, but it returns a pile of text:

$("body").each(function() {
    var text = $(this).text();
    text = text.replace('..." />', '');
    $(this).text(text);
});

Upvotes: 1

Views: 69

Answers (1)

Sampgun
Sampgun

Reputation: 2977

This is what you need

$(function() {
  var html = $("body").html();
  $("body").html(html.replace('..." />', ''));
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

Upvotes: 1

Related Questions