adding a method to obtain the JSElement and avoid passing invalid variab...

...les to JS methods