Hello friends, I need your help for youtube subscribe button on my website. I need to hide the button for thos visitor who already subscribed my youtube channel (depends on if he logged in youtube/google). The button will be visible only to them who did not subscribe or not logged in youtube/google. I think to do the I need to check the button status then hide/show based on status. But I can't do it. So I am seeking your help. The code id bellow and also the youtube button generator page link: https://developers.google.com/youtube/youtube_subscribe_button <script src="https://apis.google.com/js/platform.js"></script> <script> function onYtEvent(payload) { if (payload.eventType == 'subscribe') { // Add code to handle subscribe event. } else if (payload.eventType == 'unsubscribe') { // Add code to handle unsubscribe event. } if (window.console) { // for debugging only window.console.log('YT event: ', payload); } } </script> <div class="g-ytsubscribe" data-channel="GoogleDevelopers" data-layout="default" data-count="default" data-onytevent="onYtEvent"></div> Code (markup):
Hi, i found different classes on that button when subscribed/unsubscribed. You can start from them: yt-uix-button-subscribe-branded yt-uix-button-subscribed-branded
U can check the class and show/hide button with help of JS. Can u give me link to your page? mb i can help.