Chrome extensions: Content script (jQuery) in Youtube does not work properly
Posted
by Fabian
on Stack Overflow
See other posts from Stack Overflow
or by Fabian
Published on 2010-04-04T02:55:08Z
Indexed on
2010/04/04
3:03 UTC
Read the original article
Hit count: 359
I have this:
$(document).ready(function() {
$("button.yt-uix-expander-arrow").attr("id", "yt-uix-expander-arrow");
$("#yt-uix-expander-arrow").mouseover(function() {
alert("Hello");
});
});
injected into Youtube. Using right click > inspect element, the <button class="yt-uix-expander-arrow">
has a id="yt-uix-expander-arrow"
attribute successfully added to it. However the mouseover event does not trigger. However if I were to change $("#yt-uix-expander-arrow").mouseover()
to $(".yt-uix-expander-arrow").mouseover()
it works.
That's very unusual, because the #yt-uix-expander-arrow id has already been added to the button element. I tested it out on Facebook, adding a id to a class and doing a mouseover() event on the ID and it works.
Any idea?
© Stack Overflow or respective owner