var allRapidSpells = $$('input[value^=RSW]');
Can anyone tell me what that does?
var allRapidSpells = $$('input[value^=RSW]');
Can anyone tell me what that does?
It looks like it uses some CSS selectors using some javascript library, the CSS selectors return all input tags where the value begins RSW.
calls a method on the windows object called $$ and passes a string argument to it, which appears to be an xpath expression.
which returns input tags that contain an attribute called value starting with RSW.
It calls the function named '$$' with the parameter 'input[value...' and assigns the returnvalue of that function to the var allRapidSpells.
Javascript doesn't consider the '$' to be a reserved character, which jQuery makes excellent use of.
I would venture to guess that you're using MooTools, a JavaScript framework. The $$()
function is used to select an element (or multiple elements) in the DOM.
More specifically, the $$('input[value^=RSW]');
syntax is selecting all input
elements whose value
attribute starts with RSW
.
Other attribute selectors include:
=
: is equal to*=
: contains^=
: starts-with$=
: ends-with!=
: is not equal to~=
: contained in a space separated list|=
: contained in a '-' separated listEdit: It looks as though Prototype, another JavaScript framework, uses the same syntax.