How do I get the content of a text box from JavaScript?

2
  I added a class to the textbox called "InputValue"   Now I want to get the contents of the text box in code ,  But it doesn't work. What am I doing wrong? Thanks  
asked
2 answers
0

Make sure that the element is loaded in DOM before you try to fetch its value.

You easily check this further using the HTML/Javascript widget or just observe in browser console if you get any errors.

answered
0

Consider interacting with the Mendix data model instead of trying to attach to the input box itself. When you enter a value into the input, it writes that value into its corresponding attribute. In a nanoflow or JS action, you can easily fetch the value of an attribute. Similarly, if you change the value of an attribute in a nanoflow or JS action, the value of the text box will be updated too.

answered