x$ reference examples

As I come across more and more variant for selectors I am going to list them here once I figure out how they can be constructed

function x$(idTag, param, jd){ //Updated 28 Feb 2012
idTag=idTag.replace(/:/gi, "\\:")+(param ? param : "");
return( jd=="d" ? "#"+idTag : $("#"+idTag));
}

Basic Selecting a field by id

 jQuery  x$(“#{id:divisionNo1}”).
 dojo  dojo.query(x$(“#{id:divisionNo1}”, “”, “d”)).

Note the “”, “d” needed to let the function know this is a dojo call and therefore only return a string and not the jQuery object

Selecting multiple fields by id

 jQuery  x$(“#{id:divisionNo1}, “+”##{id:companyName1}”).
 dojo  dojo.query(x$(“#{id:divisionNo1}, “+”##{id:companyName1}”, “”, “d”)).

Note there are two ## in the query because x$ only appends a # onto the first element returned

Selecting a field by id and then by style

 jQuery  x$(“#{id:divisionNo1}, ” .xspEditBoxClass”).
 dojo  dojo.query(x$(“#{id:divisionNo1}, “+”##{id:companyName1}”, ” .xspEditBoxClass”, “d”)).

Note the space ( ) in front of the classname

Selecting a field by attribute with wildcard (no x$)

 jQuery $(“[name$=RadioButtonGroup]:checked”).val()
 dojo

This is how you would determine if a Radio Button Group has been checked

if ($("[name$=RadioButtonGroup]:checked").val() != 'Yes'){
msg="Select the option\n";
}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s