VF component IDs with colons

Some VF components (e.g. <apex:inputHidden>) cannot be assigned dynamic
IDs. We have to reference them like:

destinationForSelectedId="{!$Component.ProductId}"

As a result, the component ID contains multiple colons, e.g.:

j$('[id$=thePage:theForm:thePageBlock:lineItemsTable:0:ProductId]')

I’ve added code to escape these colons, which confuse jQuery.