Is there a way to get the value of {{org}} from this?

This question already has an answer here:

  • Get selected text from a drop-down list (select box) using jQuery 29 answers

  • 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> ).

    链接地址: http://www.djcxy.com/p/83124.html

    上一篇: Javascript函数对象有多大?

    下一篇: 有没有办法从这里获得{{org}}的价值?