This method retrieves a jQuery object by:

  • Raw ID value
  • Any ID that ends in _{id}

It's highly useful in Web Control Framework applications where you can lookup nested controls that may have a control prefix like ctl00_MainContent_txtSymbol where you can just use $$("txtSymbol") to find the element.


Return Value

jQuery object (same as $()). Check length > 0 to see if matches exist.


The id of the element to search for. Matches exact ID or anything that ends in _{id}.

The parent context where searches start from. Use this optimize searches for controls to a specific parent container. If omitted the entire document is searched. Can be a jQuery or DOM object.


Depends on jQuery.

This method has some overhead if the ID is a partial ID and it's nested deeply in the document as the entire document tree has to be traversed by jQuery to find the element and search for the ID explicitly.


<input id="ctl00_MainContent_txtSymbol" value="MSFT" />

console.log( $$("txtSymbol").attr("id") );  // ctl00_MainContent_txtSymbol

© West Wind Technologies, 1996-2024 • Updated: 08/24/2019
Comment or report problem with topic