使用Javascript或jQuery填充Text下拉列表 [英] Populate dropdown by Text using Javascript or jQuery
本文介绍了使用Javascript或jQuery填充Text下拉列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
弹出窗口中有一个asp.net下拉控件。假设我在下拉菜单中有3个选项,如Chair 1,Chair 2和CHair 3.我想按文本选择下拉项。
显示为已选中,但仍显示第一项而非选定项。
请帮忙紧急。
谢谢,
Tiru
Hi Guys,
I have one asp.net dropdown control in popup. Suppose i have 3 options in dropdown like Chair 1, Chair 2 and CHair 3. I want to select dropdown item by text.
Its showing as selected but its still displaying first item not the selected one.
Please help very urgent.
Thanks,
Tiru
推荐答案
嗨Raghava,< br $> b $ b
我希望我的代码可以帮助你....
Hi Raghava,
I hope my code can help you out....
(' #DropDownList1')。find(< span class =code-string>' option')。each( function ( i,n){
if (
('#DropDownList1').find('option').each(function(i,n){ if(
(n).text()== ' Item 5')
{
(n).text()=='Item 5') {
这篇关于使用Javascript或jQuery填充Text下拉列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文