Q:

chrome js and jquery: add a link?

I'm trying to add a text link into youtube page with "user javascript and css" extension. But the following js code does nothing, and I'm not sure but Chrome Console seems have said nothing about my js.
$(window).load(function() {
  var ytu = document.getElementsById('eow-title');
  var newlink = document.createElement('a');
  newlink.setAttribute('href', window.location.href);
  newlink.setAttribute('innerHTML', document.title);
  newlink.setAttribute('target', '_blank');
  $(newlink).insertAfter(ytu);
});

I've checked jquery2.1.0 min option.

A:

You are mixing up javascript and jQuery Objects which is bad practice:

$(window).on("load", document, function() {
  var ytu = $('.yt-user-info');
  var newlink = $("<a></a>");
  newlink.attr('href', window.location.href);
  newlink.html("Title: " + document.title);
  newlink.attr('target', '_blank');
  newlink.insertAfter(ytu.eq(0));
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<a class="yt-user-info">A</a>

