In implementing my first significant script using jquery I needed to find a specific web-control on the page. Since I work with DotNetNuke, there is no guaranteeing the control
One thing that I have done in the past (in JavaScript not jQuery), in the above my JavaScript imports, is output the dynamic controls ID's similiar to what toohool recommends and assign them to variables that I reference in my script imports.
Something like this, should allow you to take advantage of caching and still enable you to have the exact client IDs:
<head>
<script type="text/javascript>
var cboPanesID = <%= cboPanes.ClientID %>;
</script>
<!-- this JS import references cboPanesID variable declared above -->
<script src="jquery.plugin.js"></script>
</head>
Other than being a bit more expensive, performance-wise, I can't see anything wrong with using that selector. After all; you are getting the controls you want to access.
Use a marker class on the control, and select that via jQuery.
$("#<%= cboPanes.ClientID %>")
This will dynamically inject the DOM ID of the control. Of course, this means your JS has to be in an ASPX file, not in an external JS file.