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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:14:37+00:00 2026-05-27T00:14:37+00:00

I need to fire a plugin on certain trigger elements. I’m using this: $(

  • 0

I need to fire a plugin on certain trigger elements.

I’m using this:

$( ':jqmData(role="page"):jqmData(trig="true")' ).live( 'pagebeforeshow',function(e){
   console.log("detected");
   // stuff to do...
   });

Since this is my background page (first one in the DOM), using live fires it on every transition and replacing live with one only fires it on the initial trigger element and not on the 2nd element being pulled in.

Question:
How can I set up a function that is “live to trigger elements, but runs only once per trigger element found”? Would setting a flag with data help?

Thanks for infos!

  • 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-27T00:14:37+00:00Added an answer on May 27, 2026 at 12:14 am

    I guess your dilemma is that you have to use .live(), since initially there is only 1 matching element in the DOM, rather than how they are ordered? Otherwise, .one() should work fine. The manual has a nice example for how you can implement .one() using .bind(), here is how you do it with .live(), it should do the trick:

    function preparePage(e) {
        $(this).die('pagebeforeshow', preparePage);
        console.log("detected");
        // stuff to do...
    }
    
    $(':jqmData(role="page"):jqmData(trig="true")').live('pagebeforeshow', preparePage);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using this plugin to replace jQuery's imgload event with one that will fire
I need to fire some custom JavaScript validation and then submit my ASP.NET using
Is there any way to do this? When a WebView page loads I need
I need to fire asp.net (link button or Button) click event(server side code) using
I am trying to search within Google Cache, so I need to fire this
i need to fire an event (or start a workflow) when the permissions of
I need to fire an event when the mouse is above a PictureBox with
I need to fire of a bunch of threads and would like to bring
I have a ListBox with databinding. I need to fire an event when a
Need a function that takes a character as a parameter and returns true if

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.