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 3616836
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T22:32:53+00:00 2026-05-18T22:32:53+00:00

I have a question. I have 8 buttons that have unique incrementing id’s and

  • 0

I have a question. I have 8 buttons that have unique incrementing id’s and a shared class.

<button class="btnChapter" id="btnChapter_1" value="1">1</button>
<button class="btnChapter" id="btnChapter_2" value="2">2</button>
<button class="btnChapter" id="btnChapter_3" value="3">3</button>
...

In order to prevent me from duplicating code, I bound a click event to the btnChapter class instead of binding an event individually to each button’s ID.

$('.btnChapter').click(function(){ .. do stuff .. });

How do I trigger() the click() event only for #btnChapter_2? The following doesn’t seem to work.

$('#btnChapter_2').click()
  • 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-05-18T22:32:54+00:00Added an answer on May 18, 2026 at 10:32 pm

    Your code seems to be fine. Can you check whether the click event is actually binded to the button controls.

    One reason I can think of is the code is the javascript is executed before the dom is ready, so the $('.btnChapter') selector may not return any element.

    Can you check what is the value returned by $('.btnChapter').length soon after the click event is binded.

    Note: Can you manually click on the buttons and check whether the event is fired?

    Here is a sample I did in JSFIDDLE, it works fine for me.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is probably a basic html/css question... I have a simple one-button form that
A small - little question. I have seen many application having buttons like following.
I have a question to the submit- button behavior of internet explorer. If I
I have seen stackoverflow ask question page they disable button until my postback event
I have question regarding the SQLAlchemy. How can I add into my mapped class
I have a form on an HTML page with multiple submit buttons that perform
When I'm writing some JavaScript I have a set of interface buttons that have
This is an Objective-C/iphone SDK question. I have a dashboard view that is used
I need to have a physical button that when pressed will be noticed by
I have a Paper class that has 4 attributes. public class Paper(int id, String

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.