I have an HTA in which I must update the innerHTML
of a set of elements with the class driveLetter
. Before I do this I must obviously grab an array of all elements with this class.
I've tried doing this with JS, however I'm told via an error that both of the methods below are not supported (Tested with IE9 and IE11). Using these functions within an HTML file works, but this is an HTA.
var driveLetterInstances = document.getElementsByClassName("driveLetter");
var driveLetterInstances = document.querySelectorAll(".driveLetter");
The errors generated by lines above -
Object doesn't support property or method 'getElementsByClassName'
Object doesn't support property or method 'querySelectorAll'
I don't specifically have to use JS and would be open to using VBS to carry out this function, but I have no clue on how to start with that (or even if it's possible).
To replace the innerHTML of set elements you could always just do something as simple as one line like this:
JQuery Solution 1:
JQuery Solution 2:
JQuery can be used by calling it from JQuery website or can be stored locally
Example from getting from online
Example from getting from local file
Explanation of querySelectorAll()
I believe IE8 only supports
querySelectorAll()
in the standard mode. REF: Check thisSelectors API
The chances are that you're not setting the proper DOCTYPE declaration; you will need to add one.