1

I have a css file in my <head> tag, defined as follows:

<link href="foo/bar/baz.css" rel="stylesheet" class="lazyload" type="text/css">

I want to be able to remove this css file dynamically, from the javascript. However, at runtime, I won't have the full href available, only the baz.css part (That's because the file is hosted at a CDN, and the url can be dynamically generated / different each time, so it can't be hard-coded).

The css file will always have the class lazyload.

How can I remove this?

Ali
  • 261,656
  • 265
  • 575
  • 769

1 Answers1

5
$("link[href*='baz']").prop('disabled', true);
$("link[href*='baz']").remove();