how to get the value of an input box from JavaScript

Dec 07, 2012

how do i get the value from a input box from java script.

6 Replies
Steve Flowers

Each input box generates a correlated variable when it's created. Something like textEntry, textEntry1, textEntry2, etc... You can see the variable it creates in the trigger that's also created when the input box is placed.

To grab this value from JavaScript:

var player=GetPlayer();

var js_textVar=player.GetVar("textEntry");

alert(js_textVar); //or whatever you want to do with the value in JS.

Karl Wilson

Hi There.

so i tried this (i am not in a iframe)

var player = GetPlayer();

var js_textVar = player.GetVar("Input1");

alert(js_textVar); 

Nothing,  

I by mistake added a variable called (var1) to the slide i am in and gave it a default text of 'hello', 

i then used 

var player=GetPlayer();

var js_textVar=player.GetVar("var1");

alert(js_textVar); 

and get the hello text back in the javascript alert.

so i guess that i am not referencing the input box name correctly.

Any help would be much appreciated.

PS, i did notice there was a variable called TextEntry, but this did not return any results.

-------------------------

post above

we did get the value from a var by doing this

var player=GetPlayer();

var js_textVar=player.GetVar("var1");

alert(js_textVar); 

but i am still trying to talk to the input box

This discussion is closed. You can start a new discussion or contact Articulate Support.