【发布时间】:2016-05-25 20:27:06
【问题描述】:
我遇到了一个问题..
我正在使用 AngularJS 并且“在其中包含了 jQuery,但它在 HTML 页面中不起作用。为什么会这样?
$('#setting').change(function() {
alert("hi");
});
<div class="content table-responsive table-full-width">
<table class="table table-hover table-striped">
<thead>
<th>Settings</th>
</thead>
<tbody>
<tr>
<td>
<select id="setting" class="form-control">
<option>---Select---</option>
<option ng-repeat="item in settings" value="{{item.id}}">{{item.name}}</option>
</select>
<div id="btn" class="col-md-12" style="margin-top: 16px;">
<input type="button" name="Activate" value="Activate" />
<input type="button" name="Deactivate" value="Deactivate" />
</div>
</td>
</tr>
</tbody>
</table>
</div>
请帮我解决这个问题。提前致谢
【问题讨论】:
-
你需要在你的代码中引用jquery库
-
确保在页面加载之前脚本不会运行。
-
您在控制台中看到了什么?
-
打开调试器并检查控制台以确保 JQuery 已加载。
标签: javascript jquery html angularjs