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

  • Home
  • SEARCH
  • 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 8817065
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T04:45:40+00:00 2026-06-14T04:45:40+00:00

Follow w3schools The triggerHandler() method is similar to the trigger() method. Except that it

  • 0

Follow w3schools

The triggerHandler() method is similar to the trigger() method. Except that it does not trigger the default behavior of an event (like form submission) and it only affects the first matched element.

But I test with 2 input tag and use

$("input").triggerHandler("select");

then both of them are affected . Here’s my code:

HTML:

<input type="text" name="FirstName" value="Hello World" />
<input type="text" name="FirstName" value="Hello" />

JavaScript:

$(document).ready(function(){
  $("input").select(function(){
    $("input").after(" Input select event occured!");
  });
  $("button").click(function(){
    $("input").triggerHandler("select");
  });
});

Live Copy on jsFiddle

  • 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-14T04:45:41+00:00Added an answer on June 14, 2026 at 4:45 am

    The event is only being triggered on the first element. Your code, though, is outputting two lines when that happens:

    $("input").after(" Input select event occured!");
    

    That line, run once, will append the text after all matching input elements. Since there are two matching elements, you see the line twice even though the event only fired for the first element.

    Just change that one line to

    $(this).after(" Input select event occured!");
    

    …and you’ll see the output appended only after the element on which the event was triggered. Live Copy, with just the change above and removing the option to include MooTools on the page.

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

Sidebar

Related Questions

Follow-up on: How to get the children of the $(this) selector? Does not work
Follow-up question to [Does casting to a pointer to a template instantiate that template?]
Follow-up question to this question : (note that this is not a duplicate, I'm
Follow up to this question for Facebook Friends.getAppUsers using Graph API that pulls friends
Follow up to this question This (similar version from old link) works in SQL
Follow-up question to this one . Basically, in the following code, why does the
FOLLOW UP TO MARC GRAVELLS SUGGESTION IN THIS QUESTION I now have something like
the follow function is not working public function matchingService() { $stmt = mysqli_prepare($this->connection, INSERT
In follow up to this question , it appears that some numbers cannot be
Follow this : @RequestMapping(value = {/abcd/id={id},/abcd?id={id}}, method = RequestMethod.GET) public ModelAndView test(@PathVariable(id) String id)

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.