My Grease monkey script/Tamper monkey is designed to click on buttons that contain the word 'attach'. Although it works perfectly, I have noticed a difference in behavior between Chrome and Firefox.
In Firefox, the clicks occur in the order of appearance from top to bottom for all 'attach' buttons. However, in Chrome, the clicks happen in reverse order from bottom to top every time the page loads.
- What could be causing this variance in behavior?
- Would changing '==' to '===' make any difference?
Here is the code for my greasemonkey/tampermonkey script:
var inputs = document.getElementsByTagName('input');
for (x = 0; x < inputs.length; x++) {
myname = inputs[x].getAttribute('name');
if (myname.indexOf('attach') == 0) {
document.getElementsByName(myname) [0].click();
}
}