Geeks With Blogs

News

Agha Usman Ahmed JILAWATAN

Couple of days back, while implementing JQuery I had requirement of adding item to the drop down list after an AJAX Call. This is very simple when we talk about Asp.net AJAX but in Jquery you by yourself need to handle many things at the client end. Anyway, that’s how it works.

 

var ddl = document.getElementById("ddlOptions");
var
myoption = document.createElement("option"); //works with both mozilla and IE

myoption.text = $("MyText",this).text();
myoption.value = $("MyValue",this).text(); //Probably, the ID stuff
ddl.options.add(myoption);
 

I am sure the classic asp gurus must have great idea about this.

Posted on Saturday, November 1, 2008 12:28 AM | Back to top


Comments on this post: Add item in Drop Down from Java script

# re: Add item in Drop Down from Java script
Requesting Gravatar...
u suck seriously n stop copy paste shit here
Left by ur mom on Jul 04, 2012 12:46 AM

Your comment:
 (will show your gravatar)


Copyright © Agha Usman Ahmed | Powered by: GeeksWithBlogs.net