You are missing the hashtag on the jQuery
selector, it should be `$(“#frame_container).
Also, the function .contents()
only looks at the immediate children of the jQuery object/s obtained.
From the jQuery documentation:
Given a jQuery object that represents a set of DOM elements, the .contents() method allows us to search through the immediate children of these elements in the DOM tree and construct a new jQuery object from the matching elements.
<div id = "frame-container">
<iframe id="frame" width="800" height="600"
src="https://www.youtube.com/embed/tgbNymZ7vqY">
</iframe>
<button onclick="hide_related()">Hide</button>
</div>
<script>
function hide_related() {
$("#frame-container").find(".ytp-pause-overlay ytp-scroll-min")
.css("display", "none");
}
</script>