使用select标签更改侦听器更新dom

时间:2013-11-30 23:48:25

标签: javascript ajax jquery

获得以下代码:

<form action="./index.html" method="get">
                <select class=" locationdropdown selectdropdown pull-right" id="prayerMethod">
                  <option value="ISNA">ISNA</option>
                  <option value="MWL">MWL</option>
                  <option value="Egypt">Egypt</option>
                  <option value="Makkah">Makkah</option>
                  <option value="Karachi">Karachi</option>
                  <option value="Tehran">Tehran</option>
                  <option value="Jafari">Jafari</option>
                </select>
                <input type="submit" value="SUBMIT" style="display:none;">
                </form>


<script>
var mySelect = document.getElementById("prayerMethod"); 
    $(mySelect).change(function(){
         // $(this).parent('form').submit();
        // alert(mySelect.options[mySelect.selectedIndex].value );
        prayTimes.setMethod(mySelect.options[mySelect.selectedIndex].value );
    });
    </script>

我希望用selectfield标签给出的新值更新dom,该值输入到prayTimes()方法中。我怎么能这样做?

0 个答案:

没有答案