A better solution to find ASP.NET ClientIDs with jQuery
A small routine that returns us a jQuery object based on only the id:
function $$(id, context) {
var el = $("#" + id, context);
if (el.length < 1)
el = $("[id$=_" + id + "]", context);
return el;
}
So in simple usage to select my ctl00_MainContent_txtSymbol value both of the following work:
alert( $$("txtSymbol").attr("id") );
Or if I want to be specific about the container:
alert( $$("txtSymbol",$("#wrapper")).attr("id") );
Via A generic way to find ASP.NET ClientIDs with jQuery – Rick Strahl’s Web Log
No comments yet.
