I am able to bind events to all elements of a collection using JQuery. Anyway, if I want to pick just one item of the collection, no event is bound to it. In the upcoming code snippet there must be a mistake. Thanks in advance!
var divs = jQuery('.elternklasse').get(0).bind('click', function(){
alert('Bin da');
});
Use
eq():JS Fiddle demo.
To attach to an event to a specific range of elements, you could use
:gt()or:lt():JS Fiddle demo.
JS Fiddle demo.
Or to attach events to an arbitrary range of elements between two known points in the array of elements, use
slice():JS Fiddle demo.
The above will trigger the click event on elements from index-point 3 until, but not including, 6.
References:
eq().:gt()greater-than selector.:lt()less-than selector.slice().