.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> ASP.Net >> Post New QuestionBookmark and Share Subscribe to Forum

How to remove Items from Combobox using Javascript

Posted By: priya     Posted Date: February 14, 2010    Points:2   Category :ASP.Net
Hi,

I want to remove Items from Combobox using Javascript at client side using Javascript in asp.net. How can I do that?

Thanks
Priya

Responses
Author: Lalij Mer             
Posted Date: February 14, 2010     Points: 5   

Use this code sample to add/remove item from combobox using javascript

function addOption(theSel, optText, optValue){
var opt = theSel.options;
for(var i=0;i<opt.length;i++){
if(opt[i].value==optValue){
return;
}
}
opt[opt.length] = new Option(optText, optValue);
}

More Details
http://support.adobe.com/devsup/devsup.nsf/docs/51421.htm
http://www.planetpdf.com/forumarchive/121810.asp

Please Check my answer if you help....
Thank You...

Lalit.
Author: Sagar Pardeshi             
Posted Date: February 16, 2010     Points: 5   

<html>
<head>
<script language="javascript">
function deleteoption(index)
{

var sel = document.form1.select;
sel.options[index] = null;


}
</script>
<title>Untitled Document</title>
</head>

<body>
<form name="form1" method="post" action="javascript:deleteoption(document.form1.Option.value);">
<select name="select">
<option>a</option>
<option>b</option>
<option>c</option>
</select>
<br>
<br>
<input name="Option" type="text" size="20" maxlength="20">
<br>
<br>
<input type="submit" name="Submit" value="Delete Item">
</form>
</body>
</html>




Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend