jquery - 使用jquery动态添加下拉列表值(选项)
问题描述
我有一个下拉列表(Dataspy),只有一个选项,它来自云环境,现在我想动态添加一个选项到我的 DataSpy 下拉列表中(因为我没有访问云数据库的权限),下面是我附上了图像,我在 Chrome 中调试期间收到了来自云的值(在下面的情况下值是100116),我如何使用 jquery 创建一个这样的图像?我一点主意都没有 。帮我解决这个问题。
下面是我想动态添加新选项(WorkRequest)的代码。
function DropdownChange() {
//let workrequest = new Option('WorkRequest', '1');
var x = document.getElementById("ddlServices");
console.log(x);
var id = x.options[x.selectedIndex].value;
console.log(id);
$('#contenttable').empty();
$('#contenttable').append('<table id="gridview" class="table table-striped table-bordered dataTable wrap" style="width: 100%"><thead></thead><tbody></tbody></table>');
document.getElementById("lblHeading").innerText = "<%=Resources.Resource.msg_grid_loading %>"//"Loading...."
RenderData(id);
}
解决方案
推荐阅读
- reactjs - 测试没有用 Jest 调用 React prop 方法
- python - 修改 Pandas Series 列中的所有值
- javascript - 这个回调函数示例是如何工作的?
- python - 如何将灰度图像数据集加载到移动网络模型
- port - 新的 adonis 项目:服务器启动但未监听端口
- javascript - 检查一个字符串是否包含另一个字符串的某些部分并返回百分比
- vue.js - 看不到命名路线
- javascript - 在除第一个测试之外的所有测试中触发触发器后,Test-utils 不会更新 DOM
- python - Python "If" + "And" 条件忽略一个。帖子中的代码
- jinja2 - 当没有元素验证条件时,如何绕过带有“等于”过滤器错误的 selectattr?