Jump to content

IE: How to call .getElementsByClassName() <specific element here>.innerhtml inline

Recommended Posts


I know most IE objects that are collections (arrays) let you specify the element inline
consolewrite( $oElement.children(0).innerhtml &@CRLF)
However getElementsByClassName takes a peram, so I don't know how to make autoit understand what element of it i want to use when I try to use it inline. These are things I tried that all fail:
consolewrite( $oElement.getElementsByClassName("classnamehere")(0).innerhtml &@CRLF)
consolewrite( $oElement.getElementsByClassName("classnamehere").(0).innerhtml &@CRLF)
consolewrite( $oElement.getElementsByClassName("classnamehere",0).innerhtml &@CRLF)

The following code works, but is multi-line, and I want to avoid the use of a temp var
$temp = $oElement.getElementsByClassName("classnamehere")

Is there any way to call .getElementsByClassName() inline without throwing syntax errors, or do I HAVE to use temp vars?


Share this post

Link to post
Share on other sites

.getElementsByClassName is a function that returns collection so you cant use it like that. Depending on the HTML element and code , it may be done another way. Post the html code.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now