使用d3js更新下拉列表

时间:2018-03-14 22:19:01

标签: javascript d3.js

我有一个由div创建的第三方下拉列表。我想更新搜索值,但我很难做到这一点。下面是下拉列表的html以及我尝试用来更新选择的代码:

DROPDOWN HTML:

<div id="rxn-input" style="position: absolute; left: 20px; top: 459px; display: block;"><div style="position: relative; outline: 0px; border: 0px; margin: 0px; padding: 0px;"><div style="position: absolute; outline: 0px; margin: 0px; padding: 0px; border: 0px; font-size: 13px; font-family: sans-serif; color: rgb(51, 51, 51); background: transparent; top: 0px; left: 0px; overflow: hidden; visibility: visible;"></div><input type="text" spellcheck="false" style="font-size: 13px; font-family: sans-serif; color: rgb(170, 170, 170); background-color: rgb(238, 238, 238); width: 100%; outline: 0px; border: 0px transparent; margin: 0px; padding: 0px; position: absolute; top: 0px; left: 0px; box-shadow: none;"><input type="text" spellcheck="false" style="font-size: 13px; font-family: sans-serif; color: rgb(51, 51, 51); background-color: transparent; width: 100%; outline: 0px; border: 0px; margin: 0px; padding: 0px; vertical-align: top; position: relative;"><div style="position: absolute; visibility: visible; outline: 0px; margin: 0px; padding: 0px; text-align: left; font-size: 13px; font-family: sans-serif; background-color: rgb(238, 238, 238); z-index: 100; cursor: default; border-style: solid; border-width: 1px; border-color: rgb(170, 170, 170); overflow-x: hidden; white-space: pre; overflow-y: scroll; left: 0px; top: 100%; max-height: 448px;"><div id="10FTHF5GLUtl" style="color: rgb(51, 51, 51); background-color: rgb(221, 221, 221); outline: 0px;"><b>10FTHF5GLUtl</b>    10fthf5glu_c → 10fthf5glu_l</div><div id="10FTHF5GLUtm" style="color: rgb(51, 51, 51); outline: 0px;"><b>10FTHF5GLUtm</b>   10fthf5glu_m → 10fthf5glu_c</div><div id="10FTHF6GLUtl" style="color: rgb(51, 51, 51); outline: 0px;"><b>10FTHF6GLUtl</b>   10fthf6glu_c → 10fthf6glu_l</div>
        .
        .
        .
        <div id="DNDPt15m" style="color: rgb(51, 51, 51);"><b>DNDPt15m</b>  dgdp_m + dudp_c → dgdp_c + dudp_m</div><div id="DNDPt16m" style="color: rgb(51, 51, 51);"><b>DNDPt16m</b>   dadp_m + dudp_c → dadp_c + dudp_m</div><div id="DNDPt17m" style="color: rgb(51, 51, 51);"><b>DNDPt17m</b>   dcdp_m + dudp_c → dcdp_c + dudp_m</div><div id="DNDPt18m" style="color: rgb(51, 51, 51);"><b>DNDPt18m</b>   adp_m + dudp_c → adp_c + dudp_m</div><div> 2739 more</div></div></div><button class="button input-close-button">×</button></div> 

访问代码:

const input = d3.select('#rxn-input input:nth-child(2)');
input.property('value','FPGS7');
input.update();

我附上了下拉列表的图片。我感谢您提供的任何帮助/见解。 enter image description here

0 个答案:

没有答案