I’m trying to use a function in js(though not completely familiar with js) to get a value from js to controller. Currently my reply comes as a blank message. How can I get it done with this code? Controller: reply = request.vars
// install user input textfield this.typeInput = function(callbackFn) { var inputWrap = document.createElement("div id='myMessage'") inputWrap.className = "input-wrap" var inputText = document.createElement("textarea") inputText.setAttribute("placeholder", "Ask me anything...") inputWrap.appendChild(inputText) var input = document.getElementById("myMessage"); alert(input); inputText.addEventListener("keypress", function(e) { // register user input if (e.keyCode == 13) { e.preventDefault() typeof bubbleQueue !== false ? clearTimeout(bubbleQueue) : false // allow user to interrupt the bot var lastBubble = document.querySelectorAll(".bubble.say") lastBubble = lastBubble[lastBubble.length - 1] lastBubble.classList.contains("reply") && !lastBubble.classList.contains("reply-freeform") ? lastBubble.classList.add("bubble-hidden") : false addBubble( '<span class="bubble-button bubble-pick">' + this.value + "</span>", function() {}, "reply reply-freeform" ) // callback typeof callbackFn === "function" ? callbackFn({ input: this.value, convo: _convo, standingAnswer: standingAnswer }) : false this.value = "" } }) container.appendChild(inputWrap) bubbleWrap.style.paddingBottom = "100px" inputText.focus() } inputCallbackFn ? this.typeInput(inputCallbackFn) : false