How to set value of multiselect box in script?

Confluence User - 27 Jul, 2018

How can I set multiselect box value to something using javascript.

I have already tried these types of methods but to no avail:

$('#multiselectbox').val('value');

forms;selectbox

2


27 Jul, 2018
confluenceUser
confluenceUser

Hi

You can try the following.

For the example below, "MultiSelectBoxField" is the form field id for a multi select box form element and 'my choice' must be one of the available options in your select box, which you want selected:

 

$(FormUtil.getField("MultiSelectBoxField")).find("option[value='my choice']").attr('selected', 'selected');
$(FormUtil.getField("MultiSelectBoxField")).trigger("chosen:updated");

 

Also see Javascript API . Thank you.

 

 

01 Aug, 2018
confluenceUser
confluenceUser

Use methods in Javascript API#FormUtil

RELATED QUESTIONS

Your answer


To answer a question you'll need an account.

Print