Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7825981
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T09:13:41+00:00 2026-06-02T09:13:41+00:00

I am able to bind events to all elements of a collection using JQuery.

  • 0

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');
});
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T09:13:42+00:00Added an answer on June 2, 2026 at 9:13 am

    Use eq():

    var divs = jQuery('.elternklasse').eq(0).bind('click', function(){
        alert('Bin da');
    });
    

    JS Fiddle demo.

    To attach to an event to a specific range of elements, you could use :gt() or :lt():

    var divs = $('div:gt(3)').bind('click', function(){
        alert('Bin da');
    });​
    

    JS Fiddle demo.

    var divs = $('div:lt(3)').bind('click', function(){
        alert('Bin da');
    });​
    

    JS Fiddle demo.

    Or to attach events to an arbitrary range of elements between two known points in the array of elements, use slice():

    var divs = $('div').slice(3,6).bind('click', function(){
        alert('Bin da');
    });​
    

    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().
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using jQuery to bind to all links on the page (I'm using the
In WPF and SubSonic 2 using Active Record, I was able to bind to
I've added a toolbar to my grid I'm not able to bind the event
I am using bind/unbind for mousewheel scrolling, based on this SO response: Jquery, unbinding
Basically I want to be able to call jQuery from FireBug, place code that
I want to be able to do this $('.class').bind({'click':'function(){ ... }'}); // note that
I'm able to detect the cut, copy, paste events with the following code $('#searchInput').bind('cut
I want to add a MouseOver event handler for any tag. Let say just
I am using the anything slider jquery plugin with the touch events. it appears
I want to be able to email a report daily from a glpi database

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.