I have created a chrome extension that successfully creates a popup with a basic test if else statement. I would like to have the if statement be (if: the current active page contains "a certain string of html code (or image name)" than popup message is displayed)
I have tested multiple jquery if else statements about reading html elements but none seemed to work
The code below works changing the variable back and forth to display the correct alert. However, I would like to make the if statement to be searching the current page for a certain checkbox that is within a unique div and has an image that is either img_checked or img_unchecked. If the image is checked i want the if statement to return true, and if not return false
popup.js
var a = 1;
if (a == 0){
alert("True");
}
else {
alert("false");
}`
code currently works but If i try to try adding an if statement that scans the page for the set of html i want, the page alert doesnt show at all.
I tried this code and had no alert come back:
val $nav = jQuery('id="img_chkbox" title="Checked"');
if( $nav.length > 0 && $nav.is(':visible')==true){
alert("true");
}else {
alert("false");
}