Input for Chat application (WebChatUI module)

Hello, To build a chat Application in Mendix I have used WebChat UI module. And for the chat_overview page I am using a pre build page from that module. In the javascript snippet it is passing the input by the id of the input field. Now for customising it further, instead of normal text boxt I am using a speech to text widget. So I have to pass the id of that particular widget to the javascript action.  From the browser, if I inspect I can find that the id of the textbox already defined. but no id is defined for Speech to text field. Also I can not define the id as it is a prebuild widget I downloaded from marketplace. So how can I pass the input of Speech to Text widget?    Thanks in advance.
1 answers

You could instead use getElementsByClassName since it does have a class. Note that instead of a single element, it gives you a list of elements, so afterwards you'll have to fetch the first element like below:


const myClassElements = document.getElementsByClassName('my-class'); 
const firstElement = myClassElements[0]; // Access the first element

You'll then have to see if the speech to text element's content can be accessed the same way or if you need to change something there, but this should at least allow you to select the right element.