[Unity UI 5.4.1] Getting Value from InputField

Hi everyone,
I’ve recently started upgrading all of my old legacy UI to Unity’s revamped UI. I’ve come across a problem in my code where I can’t seem to get text assigned to a variable from the InputField. My code (in JavaScript) looks like this:

currentText = gameObject.Find("Canvas/Panal/Input Field").GetComponent(InputField).text;

When I go back into the editor, I have the error “Unknown identifier: ‘InputField’.” I’ve tried as many combinations of this code as I could think of and I’ve done a couple hours of research into the matter and can’t seem to find where someone has had a similar error.
Any help would be greatly appreciated but please bear in mind that I use JavaScript. Translation between C# and JS is not a strong suit of mine.
Thanks.

I seemed to figure it out on my own after enough trial and error. I changed:

currentText = gameObject.Find("Canvas/Panal/Input Field").GetComponent(InputField).text;

to:

currentText = gameObject.Find("Canvas/Panal/Input Field").GetComponent(UI.InputField).text;

Im more C# with Unity, though if its an identifier problem, its possible you never imported/included the Unity UI class

Notice line 3 in JS - not having this could be your issue.