How do I get the text value of a selected option?

How do I get the text value of a selected option?

DaveNavarroDaveNavarro Posts: 18Questions: 7Answers: 0

Hello,

I need to store the selected text for another step in a process and I seem to only be able to get the value (not text) by using; $(this).val()

The event I've wired up is the "input().on('change')" as seen below.

editor.field('Vendor').input().on('change', function(e, d) {
if (d && d.editorSet) return;
editor.field("VendorOptionId").set($(this).val());
editor.submit();
showSaveButton(true);
});

Please let me know if there's a way to get the text from the associated select list option.

Thank you,

~ Dave

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,516Questions: 1Answers: 10,473 Site admin
    Answer ✓

    You can use a little bit of jQuery along with the field().input() method for this:

    editor.field( 'Vendor' ).input().find('option:selected').text();
    

    Allan

This discussion has been closed.