Want to click an href if it contains a certain substring
var styleCode = "827053-010";
document.querySelector("a[href="+styleCode+"]").click();
works fine when my variable has letters at the start but doesn't seem to work when im looking for numbers
Wrap attribute value within quotes inside attribute equals selector.
var styleCode = "827053-010";
document.querySelector('a[href="'+styleCode+'"]').click();
// here ---^-------------^---
var styleCode = "827053-010";
document.querySelector('a[href*="'+styleCode+'"]').click();
// ---^---