The issue arises because Bubble.io generates a checkbox as a subordinate element under the div element, which acts as the parent. Therefore, your code could see only the parent element.
So when you assign ID Attribute to Bubble.io’s checkbox element it assigns to the div element, not the input checkbox.
Yes. In other words, my code first finds the div element, then it locates the checkbox within this div element. After identifying the checkbox’s id, it finds the checkbox using this id and logs its status in the console.
Having problems doing an If statement to check the value of a dropdown selected item in my Toolbox Run Javascript Action Item.
I have the statement…
var psw = document.getElementById(‘PGPASSWORDSTARTSWITH’).value;
when I do a console.log on the variable psw, I get
Upper Case (which is what I should see)
when I run the next two statements that follow the console statement,
If (psw == “Upper Case”) {
console.log(“psw is Upper Case”);
}
It appears that psw is found to be not equal to “Upper Case” because the statement that follows doesn’t print to the console. I’ve tried setting psw_value = psw.options[psw.selectedIndex].text; and then doing the if statement on psw_value. Tried some other things that haven’t worked as well. How should I code the test so that it will work correctly?
Another useful diagnostic is to put in your script
window.mypsw = psw;
Then in the console you can play with the global variable mypsw to see what is happening. I like to rename it to be a reminder that its a copy, not the actual value.