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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:06:33+00:00 2026-05-27T06:06:33+00:00

I am trying to use selectors with trigger and bind in jQuery. Its a

  • 0

I am trying to use selectors with trigger and bind in jQuery. Its a simple code and i can’t seem to get it working :(.

Here is what i am doing.

$(document).ready(function (){

var ctrlChanged = jQuery.Event("CtrlChanged");

  //********** Any time a button with id*=btnAddNewEmailAddress is clicked, raise event that parent control has changed.
$('[id *= "btnAddNew"]').click(function () {
  $('[id *= "btnAddNew"]').trigger(ctrlChanged);
});
});

To subscribe to above event i am using following code.

$('[id *= "btnAddNew"]').bind('CtrlChanged', function(){alert('Control Changed')})   

This combination is not working. When i click buttons with id matching “btnAddNew”, i don’t see alert message.

But if i replace [id *= “btnAddNew”] with something like

$('body').trigger('ctrlChanged')

then corresponding change in bind

$('body').bind('ctrlChanged', function(){alert('Control is changed'})

works like charm.

I am wondering if, trigger and bind works with selectors. I would think so… but they are not..

If yes then what am i doing wrong?

  • 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-27T06:06:34+00:00Added an answer on May 27, 2026 at 6:06 am

    I would change this:

    $('[id *= "btnAddNew"]').click(function () {
      $('[id *= "btnAddNew"]').trigger(ctrlChanged);
    });
    

    to

    $('[id *= "btnAddNew"]').click(function () {
      $(this).trigger(ctrlChanged);
    });
    

    You might also have to move the ctrlChanged event object to global scope; i.e. move it outside of the $(document).ready(), right before it would be good.

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

Sidebar

Related Questions

I am trying to use a jQuery selector on data I get back from
I'm a little confused about which jQuery method and/or selectors to use when trying
I doing a little jquery+greasemonkey which I'm trying to use to redo an interface
I'm trying to use the :visible and :first-child pseudo-selectors together in jQuery and it
I'm trying to use XPath selectors with JQuery , but when I drop down
I am trying to use jQuery to show a div when the user selects
I am trying use a Java Uploader in a ROR app (for its ease
I am trying to use the text attribute as a selector, but I can't
I'm trying to apply unknown styles to unknown selectors and it would seem that
i want to further use css selectors on this how can i do it?

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.