How use Select Option in Watson Conversation

I'm trying to insert the select options tag into my conversation, to make it more simple to the user. I did this:


And in the index.js:

function selected(){
switch($('#selected option:selected').val()){
    case 01:
    case 02:

But it doesn't recognize the option selected. I tried without the function selected() (only with switch case), but it didn't worked.. Can somebody help me please? Thanks a lot!



I believe your HTML inside the Advanced context have something you miss.

In your HTML in onselect your typed :, but, for use onselect and call one function you have to use onselect="nameFnction()"

See one simple example inside MDN to use this tag:

<input type="text" onselect="myFunction()" value="Hello world!">

Now, see other example for works fine according the choice:

  <option onclick="doSomethingA(this);">A</option>
  <option onclick="doSomethingB(this);">B</option>
  <option onclick="doSomethingC(this);">C</option>

And with jQuery (Your id is select and not selected):

$('#select option:selected').val()


Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.