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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T19:26:46+00:00 2026-05-21T19:26:46+00:00

On a page there are couple of Add buttons ( li .plus ). When

  • 0

On a page there are couple of Add buttons (li .plus).

When you click on a Add button and assume json.success is false, it will then popup via $.colorbox plugin

The popup pull the data from href:"/Handle/Postcode/?val" + Val

There is a submit button (#submitButton) from the popup, when I click on the submit button, it keep popup alert box a few times, I dont understand why that happen? how to fix it?

$("li .plus").click(function(event) {
    event.preventDefault();

    var Val;
    Val = $('#id').val()

        $.getJSON(Address +"/Handle/Add", {
            Val:Val
        }, function(json) {
            if (json.success == "false" && json.error == "NoArea") {
                $.colorbox({
                    width:"450px",
                    transition:"none",
                    opacity:"0.4",
                    href:"/Handle/Postcode/?val" + Val
                });
                $("#submitButton").live('click', function() {
                   var PostCodeArea = $("#deliveryAreaPostcode").val();
                    alert(PostCodeArea);
                    //Why does it popup a few times?
                });

            }

            if (json.success == "true") {
                Backet();
            }
        });
});
  • 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-21T19:26:46+00:00Added an answer on May 21, 2026 at 7:26 pm

    Thats an easy one, because you are using the .live() function to bind your click handler. If that code gets executed more than one time your binding happens more than one time.

    You can either try to track the state of the binding and only apply it if it doesn’t exist, or you can call your click function in the html with the onClick attr.

    Edit: Just to clarify I meant something along the lines of –

    HTML

     <button id='submitButton' onclick="displayAreaCode();">Submit</button>
    

    JS

    function displayAreaCode(){
        var PostCodeArea = $("#deliveryAreaPostcode").val();
        alert(PostCodeArea);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

On the page there are links displayed with CSS as buttons: HTML: <a class=button
I got the requirement like, In a page there will be 4 panels which
I have a page where I want to add couple of controls when I
I want to add a button, with an onclick event, to the page. It
Is there a way to do this (psedo code): GetCurrentThread().Items.Add(new RefObject); then later on
I have an asp.net page and I'm trying to add a couple of hidden
in my page there are few hidden field which are filled with the correct
On this page there is a list of footer links that have a little
On the Groovy example page there is an example of how to use Groovy
I'm loading a page in an iframe colorbox. On this page there's a form

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.