How can I get the value inside the selectbox using the Javascript API

Confluence User - 29 Aug, 2023

So I am trying to get the value from a label "Mongrel" inside the selectbox and I looked at the Knowledge Base but it only shows getField(fieldId) which works to get value from a text field only but it doesn't really help me to find how to get values in the selectbox.


How can I get that value?

javascript;selectbox

3


30 Aug, 2023
confluenceUser
1
confluenceUser

User the following script in custom HTML

    $("[name=selectbox1]").change(function() {
        let label = $('#selectbox1_chosen span').text();
        let valu = $(this).val();
        $("[name=Field]").val(label);

    });

30 Aug, 2023
confluenceUser
confluenceUser

Thank you for your help! It works now

30 Aug, 2023
confluenceUser
confluenceUser

Awesome!

RELATED QUESTIONS

Your answer


To answer a question you'll need an account.

Print