[Solved] Is there a way to get the value of {{org}} from this? [duplicate]


Without the quotes, nameOrg is an invalid JavaScript variable.

    $(nameOrg)

Here’s the right way to select an element by it’s ID:

    $('#nameOrg')

Reference: https://api.jquery.com/id-selector/

Also, I see your html document does not contain any reference of jQuery. Make sure you are importing the library.

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>

I strongly suggest wrapping the code in a jQuery ready function as well, otherwise $ will not be available at runtime.

After you have done all the above, refer to the linked duplicate question on how to get the selected text. What .val() does is to get the selected option’s value (<option value="text"></option>), not the text between the option tag (<option>text</option>).

1

solved Is there a way to get the value of {{org}} from this? [duplicate]