I'm developing a chrome extension , my intention is
<button id="j_id_ae" name="j_id_ae" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" aria-label="" onclick="fscr();PF('fscrDlg').hide();" type="button" role="button" aria-disabled="false"><span class="ui-button-text ui-c">Go Full Screen</span></button>
call the function PF('fscrDlg') when ever the button appears on the screen
function checkForChanges() {
console.log("hello");
let buttons = document.getElementsByTagName('button');
if(buttons){
for(let i = 0 ; i < buttons.length ; i++){
if(buttons[i].innerText.includes('Go Full Screen')){
PF('fscrDlg').hide();
}
}
}
}
setInterval(checkForChanges, 1000);
This is my content.js but the error says function PF is not defined however when I run the function in chrome console it's working fine. How to access the dom js from content js in manifest v3
I tried different methods like changing the onlick of the button and then pressing on the button like
buttons[i].onclick = PF('fscrDlg').hide();
buttons[i].click();
but this isn't changing the dom.