如何使用Jquery从下拉列表中查找所选值

时间:2016-08-19 20:40:21

标签: jquery

<div class="awe-ajaxdropdown-field">
    <input data-notr="1" name="TestFIName" id="TestFIName" class="awe-val" type="hidden" value="7126">
    <select class="awe-display awe-field form-control" style="background-color: rgb(255, 255, 255);">
        <option value="">--Select test--</option>
        <option value="7172">1000RPM 380PBA all patterns</option>
        <option value="7173">1000RPM low load tight all patterns</option>
        <option value="7141">10pct 2KM noise without krrefend learned mp data</option>
        <option value="7174">1500RPM 230PBA all patterns loose</option>
        <option value="7175">2000RPM 230 PBA all patterns</option>
        <option value="7176">2000RPM low load tight all patterns</option>
        <option value="7179">2500RPM 230 PBA all patterns and continuous random</option>
        <option value="7177">2500RPM pattern misfire no load line</option>
        <option value="7131">2MF_2SF-7003_1_CELL4_20160506_006</option>
        <option value="7128">2MF_2SF-7003_10cStart_CELL4_20160506_003</option>
        <option value="7129">2MF_2SF-7003_4hrSoak1_CELL4_20160506_004</option>
        <option selected="selected" value="7126">2MF_2SF-7003_FIMISFIRE_CELL4_20160506_002</option>
        <option value="7125">2MF_2SF-7003_IGMISFIRE_CELL4_20160506_001</option>
        <option value="7130">2MF_2SF-7003_InGear4hrSoak1_CELL4_20160506_005</option>
        <option value="7142">2YM 10pct offset noise file Feb 2016</option>
        <option value="7168">2YM MF toughness2 219AT SW and fire air rev2 052716</option>
        <option value="7152">3500 higher loads issue</option>
        <option value="7153">4000 rpm low load and 230 MF data</option>
        <option value="7154">4500 rpm 380 pba detection</option>
        <option value="7155">4500 rpm low load</option>
        <option value="7178">drive 600rpm all misfire types OK</option>
        <option value="7157">drive with 10pct noise in cyl3</option>
        <option value="7158">drive with cylinder5 offset noise</option>
        <option value="7160">neutral with 10pct noise in cyl3</option>
    </select>
    <script type="text/javascript">
        jQuery(function(){
            awe.add({
                l:1,type:'add',
                i:'TestFIName',
                url:'/GetData/GetTestName'
                data:{"keys":["parent"
                    "parent"
                    "parent"
                    "parent"]
                    "vals":["ProjectName"
                        "VehicleName"
                        "TestModeName"
                        "testRange"]},
                pars:{ keys:[],

                    vals:[]},
                e:1});
        });
    </script>
</div>

如何使用Jquery在此处找到所选选项。

1 个答案:

答案 0 :(得分:0)

<div class="awe-ajaxdropdown-field">
  <input data-notr="1" name="TestFIName" id="TestFIName" class="awe-val" type="hidden" value="7126">
  <select class="awe-display awe-field form-control" style="background-color: rgb(255, 255, 255);">
    <option value="">--Select test--</option>
    <option value="7172">1000RPM 380PBA all patterns</option>
    <option selected="selected" value="7126">2MF_2SF-7003_FIMISFIRE_CELL4_20160506_002</option>
    <option value="7125">2MF_2SF-7003_IGMISFIRE_CELL4_20160506_001</option>
    <option value="7130">2MF_2SF-7003_InGear4hrSoak1_CELL4_20160506_005</option>
    <option value="7142">2YM 10pct offset noise file Feb 2016</option>
    <option value="7168">2YM MF toughness2 219AT SW and fire air rev2 052716</option>
    <option value="7152">3500 higher loads issue</option>
    <option value="7158">drive with cylinder5 offset noise</option>
    <option value="7160">neutral with 10pct noise in cyl3</option>
  </select>
</div>

<强>的jQuery

alert($(".awe-ajaxdropdown-field select").val());