Skip to main content
Inspiring
November 22, 2016
Answered

Why can't I access text entry box value in Javascript from another slide?

  • November 22, 2016
  • 1 reply
  • 465 views

I have a simple line of code (on button click) to get s string from a text entry box and input it into a variable value:

var fillCount= document.getElementById('Text_Entry_Box_1_1_inputField').value;

This works fine if the button is on the same slide, but doesn't work from a different slide.  Any suggestions?  Thanks.

    This topic has been closed for replies.
    Correct answer TLCMediaDesign

    That's because the element is no longer rendered in the window (DOM). You are probably getting a can't access property of an undefined object error.

    Assign that value to a variable and then you can always access it.

    1 reply

    TLCMediaDesign
    TLCMediaDesignCorrect answer
    Inspiring
    November 22, 2016

    That's because the element is no longer rendered in the window (DOM). You are probably getting a can't access property of an undefined object error.

    Assign that value to a variable and then you can always access it.

    Lilybiri
    Legend
    November 22, 2016

    That value is in a variable, why do you have to assign it to another var?

    RodWard
    Community Expert
    Community Expert
    November 23, 2016

    Lieve,

    While what you say is correct, I think Dave was talking about a JavaScript variable, not the Associated Variable of the TEB. 

    If the OP is trying to do ALL of this via JS then they'd have to do as Dave suggested and create a JS variable to store the value from the TEB for later use.  If they are happy to change the code to just reference the associated user variable then your suggestion would be fine as well.