Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

180
Views
Getting sender in jQuery

I have a large list of check boxes all with unique id values. I'd like to get the id of the checkbox that executes my JavaScript function. Can I do this using $(this)?

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

You can get the target of the event using event.target.

$('input:checkbox[id]').change(function(event) {
  var checkboxID = $(event.target).attr('id');
  alert(checkboxID);
});

JSfiddle Demo

over 4 years ago · Santiago Trujillo Report

0

If this points to your checkbox, then you would get the id using $(this).attr('id')

For example:

$('input:checkbox').click(function(){
    var id = $(this).attr('id');
    // do something with id
});

See DEMO.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!