Yoona Yoona - 6 months ago 53
HTML Question

How to print link tag

Hi because I need to check all current css that are included in my site (wordpress), and delete it hopefully to combine and include it again in footer (for removing render block in google page speed test).
First, I want to print it to check what is that css. (it maybe from many themes and plugins, I can not find it manually).

This is my jquery to print it but it does not show anything, Please help me.

$string = '';
jQuery('head link').each(function(i, obj) {
$string += jQuery(this).html() + ' ';
alert('' + $string);

I want to see something like this :

<link rel="stylesheet" type="text/css" href="mystyle.css">
<link rel="stylesheet" type="text/css" href="mystyle1.css"> (if I found this one I want to remove it or at least check href to know where it is, please help me if you know how to do it).


You could simply do this :)


<p class="test"></p>


      $('link').each(function(i, obj) {
        $(this).attr('href', ''); //replaces 'href' value to empty string