Frage

what is Difference between "$$" and "$"?

$$('#items li').each( function(item) {
  item.observe('click', function(event) {
    doSomethingWith(event.target);
  });
});

==========================

$('items').observe('click', function(event) {
  if (event.target.tagName === 'LI') {
    doSomethingWith(event.target);
  }
});
War es hilfreich?

Lösung

See the Prototype.js documentation

$ — id (String | Element) — A DOM node or a string that references a node's ID

$$(cssRule...) — Takes an arbitrary number of CSS selectors (strings) and returns a document-order array of extended DOM elements that match any of them.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top