JQUERY / js如何从api响应中制作下拉菜单

时间:2018-09-20 02:58:23

标签: javascript jquery api drop-down-menu

根据下面的代码,如何使newField像这样sample another sample这样的下拉菜单文本字段,因为现在它仍然是文本字段。然后,该值是来自此剩余api https://jsonplaceholder.typicode.com/todos的“标题”列表。谢谢

var addRuleLink = $("<a>", {"href": "#", "class": "add-rule", "text": "Add Condition"});
      var _this = this;
      addRuleLink.click(function(e) {
        e.preventDefault();
        var f = _this.fields[0];
        var newField = {name: f.value, operator: f.operators[0], value: null};
        div.append(_this.buildRule(newField));
      });
      div.append(addRuleLink);

0 个答案:

没有答案