Domanda

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);
  }
});
È stato utile?

Soluzione

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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top