猿问

获取到的值 改怎样传入到输入框呢

我想把下面获取到的textarea的值传入到下拉框里面 可是不知道这个代码错在哪里了,请前辈指导

凤凰求蛊
浏览 494回答 1
1回答

当年话下

<script>&nbsp; $(function(){&nbsp; &nbsp; $(".getcol").click(function(){&nbsp; &nbsp; &nbsp; this.options.length = 0;&nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp; var text = $('#data_matrix').val();&nbsp; &nbsp; &nbsp; var allcon = text.split("\n");&nbsp; &nbsp; &nbsp; var firstcol = allcon[0].split("\t");&nbsp; &nbsp; &nbsp; var count = firstcol.length;&nbsp; &nbsp; &nbsp; for(var i=0, l = firstcol.length; i<l; i++){&nbsp; &nbsp; &nbsp; &nbsp; this.add(new Option(firstcol[i], firstcol[i]));&nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; $(this).selectpicker('refresh');&nbsp; &nbsp; })&nbsp; })</script>
随时随地看视频慕课网APP

相关分类

JavaScript
我要回答