I'm not a JavaScript expert but I found this on Google to set a checkbox :
https://www.w3schools.com/jsref/prop_ch ... hecked.asp
https://stackoverflow.com/questions/820 ... or-vanilla
I also found this about the getBoundingClientRect() method :
https://www.w3schools.com/jsref/met_ele ... ntrect.asp
https://stackoverflow.com/questions/928 ... om-element
Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.
Using JavaScript to set values on a web page - Help Needed on Setting Checkbox
- salvadordf
- Posts: 4565
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
- salvadordf
- Posts: 4565
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: Using JavaScript to set values on a web page - Help Needed on Setting Checkbox
The w3schools link for getBoundingClientRect has a "Try it" button with the code you're looking for :
Code: Select all
var div = document.getElementById("myDiv");
var rect = div.getBoundingClientRect();
x = rect.left;
y = rect.top;
w = rect.width;
h = rect.height;
alert ("Left: " + x + ", Top: " + y + ", Width: " + w + ", Height: " + h);
Re: Using JavaScript to set values on a web page - Help Needed on Setting Checkbox
Try this
Code: Select all
...
{ if ((items[i].name == "piiCheckBox") and (!items[i].checked)) {items[i].click(); }
Re: Using JavaScript to set values on a web page - Help Needed on Setting Checkbox
JSCode:='document.getElementsByTagName("INPUT"); for (var i = 0; i < items.length; i++) { if ((items.name == "piiCheckBox") and (!items.checked)) {items.click(); }';stwizard wrote: Mon Aug 19, 2019 12:48 am Greetings Salavadord,
I know "..." means code preceding the line you wanted me to try, but what code precedes It to then use items?
Mike