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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:26:50+00:00 2026-05-28T07:26:50+00:00

Using this call <a href=deleteDialog.html data-rel=dialog data-transition=pop data-role=button id=’deleteDialog’>Delete</a> to get the following dialog

  • 0

Using this call <a href="deleteDialog.html" data-rel="dialog" data-transition="pop" data-role="button" id='deleteDialog'>Delete</a> to get the following dialog page:

<div data-role="page" id="deleteCompanyDialog">
<script type="text/javascript">

$("#deleteButton").live("click", function() {
        alert("this alert increments");

});

</script>

    <div data-role="header" data-theme="d">
        <h1>Dialog</h1>

    </div>

    <div data-role="content" data-theme="c">
        <h1>Delete Company</h1>
        <p id="message"></p>
        <a data-role="button" data-theme="b" id="deleteButton" >Sounds good</a>       
        <a href="company.jsp" data-role="button" data-rel="back" data-theme="c">Cancel</a>    
    </div>
</div>

seems to retain the live("click".. binding from any previous calls to this dialog and then binds the live call again. So if I call the page 4 separate times, on the forth dialog page call it will popup 4 alert screens. Is there a way to have the javascript still be within data-role="page" so it can load with ajax but not increment the “live” binding. I tried $("#deleteCompanyDialog").live("pagecreate"... as well as pageload (a long shot) which does not work either.

Help would be greatly appreciated.

  • 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-28T07:26:50+00:00Added an answer on May 28, 2026 at 7:26 am

    Instead of using .live(), use .bind() and place your JavaScript in a delegated event handler:

    <div data-role="page" id="deleteCompanyDialog">
    
        <div data-role="header" data-theme="d">
            <h1>Dialog</h1>
    
        </div>
    
        <div data-role="content" data-theme="c">
            <h1>Delete Company</h1>
            <p id="message"></p>
            <a data-role="button" data-theme="b" id="deleteButton" >Sounds good</a>       
            <a href="company.jsp" data-role="button" data-rel="back" data-theme="c">Cancel</a>    
        </div>
    <script type="text/javascript">
    
    $(document).delegate("#deleteCompanyDialog", "pageinit", function() {
        $("#deleteButton").bind('click', function () {
            alert("this alert DOES NOT increment");
        });
    });
    
    </script>
    </div>
    

    This is like using $(function () {}); but for jQuery Mobile. The pageinit event will fire when the page is initialized (happens once per pseudo-page) and the .bind() function call will only bind to elements present in the DOM. When you use .live() it doesn’t bind to the actual element, it binds to the document element, which does not get removed when you navigate away from the dialog (so each time you show the dialog you add another delegated event handler).

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

Sidebar

Related Questions

I am loading feed-items into a ul using this jQuery .ajax() call, which I
I'm calling a SSIS package using LoadPackage(...). Is it possible to make this call
Below is my Oracle Procedure. When i call this procedure using java, it throws
I'm getting a java outOfMemoryError when I call this method - i'm using it
I'm making call to Alfresco Webscripts which return JSON. I do this using GET
This is the code I am using to call a function calc in javascript:
I'm using a third-party library which accesses fonts through the GraphicsEnvironment: getAllFonts() call. This
I using VB.NET 2.0. I am trying to call a web service. This web
I'm getting in trouble. I'm trying to emulate the call Application.Run using Application.DoEvents... this
I'm implementing Simplemodal in an application of mine using this code: $(.dialog-link).live('click', function(e) {

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.