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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T08:12:25+00:00 2026-05-28T08:12:25+00:00

I have a piece of code that will sometimes need to be triggered by

  • 0

I have a piece of code that will sometimes need to be triggered by a script, but I don’t want it to change the URL on my page. (it messes up the history state for some odd reason)

The code I need to trigger:

 $(".photos-bottom .albums #albums li").live("click", function() {
  // my action here
 });

 The code I use to trigger it:
 $(".photos-bottom .albums #albums li:first").trigger("click");     

The link to click, however I just noticed, it’s suppose to click the li and the li is inside of the href so i don’t know why it’s still clicking it..

<a href="#/photos/1/album/42/" rel="address:/photos/1/album/42/">
<li id="42">
  • 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-28T08:12:26+00:00Added an answer on May 28, 2026 at 8:12 am

    try triggerHandler() instead: http://api.jquery.com/triggerHandler/

    The .triggerHandler() method behaves similarly to .trigger(), with the following exceptions:
    The .triggerHandler() method does not cause the default behavior of an event to occur (such as a form submission)… [omissis]

    Otherwise use trigger() with an extraparameter in the call (see http://api.jquery.com/trigger/) and in your handler just check the arguments passed. If a parameter was passed then you will prevent the default link action with. <evt>.preventDefault()

    (note: I assume you handler is attached to links element, not to the list item, since you cannot wrap a list item into a link)

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

Sidebar

Related Questions

I have a piece of code that will take a string and repeat it
I have the following piece of code that will give me the date 1
I'm looking for a simple piece of code that will change all the backslashes
I have a relatively small piece of initializer code that I want to run
i have the following piece of code in the page HEAD: <script type=text/javascript> $(document).ready(function(){
I have a piece of code that will return a flat sequence for every
I have a piece of code that is working fine in IE, but it
I have this piece of code that does not work: public CartaoCidadao() { InitializeComponent();
I have this piece of code that works fine in subsonic 2.2, I migrated
I have a piece of code that load a very big image in memory.

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.