prototypejs - Prototype $$ returns array, should return one element like $ -


when using dollar-dollar-function in prototype alway array of elements back, instead of 1 element dollar-function. how can combine power of css-selectors of $$ still 1 element back?

changing structure of source not possible, can't select id. needs selected css, should return 1 element.

it not make sense return single element when selecting class name because potentially there many elements in dom have class. use first element of returned array if sure unique.

$$('.foo')[0] 

Comments

Popular posts from this blog

ruby - When to use an ORM (Sequel, Datamapper, AR, etc.) vs. pure SQL for querying -

php - PHPDoc: @return void necessary? -

c++ - Convert big endian to little endian when reading from a binary file -