JQuery函数不会在ejs中触发

时间:2017-11-30 21:15:52

标签: javascript jquery ejs

bubbleSort

我试图通过jquery获取所选文本。但是,即使是就绪警报也不会显示。我错过了什么吗?另外,我是否正在尝试以正确的方式获取所选文本?

2 个答案:

答案 0 :(得分:1)

绑定on('change'事件。

工作示例:



<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script type="text/javascript">
$( document ).ready(function() {
    alert( "ready!" );
    
    $('#dropDown').on('change', function() {
      alert( this.value );
      console.log("run");
    var selected = this.value;
    console.log(selected);
    })

    
});

</script>

<div class="row">
            <div class="col-lg-12">
                <h1 class="page-header">
                    <center>Benchmark Usage</center>
                </h1>
            </div>
            <!-- /.col-lg-12 -->
  </div>
<div class="row" data-ng-controller="">
<div class="col-md-12">

<select id="dropDown">
<option value="day">every day</option>
<option value="minute">every minute</option>
</select>

<iframe src="http://vgzeburt55:5601/goto/517982d9d05378bac8368b4bf91338fe?embed=true" height="710" width="100%"></iframe>
</div>
</div>
&#13;
&#13;
&#13;

答案 1 :(得分:1)

你的jquery src不应该有 https:前缀吗?

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>