Ashwini Nayak Ashwini Nayak - 1 year ago 92
jQuery Question

How do I concatenate my element id in this scenario?

How can I get the selected text for a drop down in the below scenario?

var abc = $("#ddlReason"+bidId+"option:selected").html();

As you see above, "bidId" is a variable that I need to suffix with the dropdown id "ddlReason".

Answer Source
string.Format("#{0}{1} option:selected", ddlReason, bidId);

this will build your string the way you want it.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download