本文介绍了无法从客户端添加列表框中的值。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在客户端(javascript和jquery)的列表框中添加值。



我尝试过:



我试过了js和jq,但都没有用,

我在JQ的代码

How to add values in list box from client (javascript and jquery).

What I have tried:

I tried both js and jq , but both not working,
my code in JQ

var value = 'aravind';
var listBox = $("lstProfLstS1");
var option = $("<option />").val(value).html(value);
listBox.append(option);
return false;



我在JS中的代码


my code in JS

var Val1='aravind';
var opt1 = document.createElement("option");
opt1.innerHTML = Val1.replace(/ /g, "\xA0");
opt1.value = Val1;
document.getElementById("lstProfLstS1").options.add(opt1);





问候,

Aravind



Regards,
Aravind

推荐答案




我在JS中的代码


my code in JS

var Val1='aravind';
var opt1 = document.createElement("option");
opt1.innerHTML = Val1.replace(/ /g, "\xA0");
opt1.value = Val1;
document.getElementById("lstProfLstS1").options.add(opt1);





问候,

Aravind



Regards,
Aravind



这篇关于无法从客户端添加列表框中的值。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-30 01:29