0

JS Code:

var a = {
    innerText: function (id) {
        ST.element(row + DnDTarget.gridRow(id))
            .and(function (el) {
                console.log(el.dom.innerText); // Outputs InnerText value 
                return el.dom.innerText;
        });
    }
}

var beforeText = a.innerText(1);
console.log(beforeText) // outputs undefined

How do I return el.dom.innerText? I even tried putting it inside a variable and then return it, But that didn't work as well.

SR1
  • 33
  • 7
  • Possible duplicate of [How do I return the response from an asynchronous call?](https://stackoverflow.com/questions/14220321/how-do-i-return-the-response-from-an-asynchronous-call) – Nick Parsons Jun 20 '19 at 02:35
  • 2
    Maybe add another `return` before `ST.element`. It should look like this `innerText: function(id){ return ST.element .........` – Colin Cline Jun 20 '19 at 02:47
  • No.. sadly that didn't work :( – SR1 Jun 20 '19 at 05:02

0 Answers0