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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T12:42:31+00:00 2026-05-19T12:42:31+00:00

I know subject was not clear but I couldn’t find a better sentence. I

  • 0

I know subject was not clear but I couldn’t find a better sentence.

I am building an ajax form. Currently I can save form fields into db via clicking save button and getting values from db with edit button. I also change the #id of save button when edit button clicked. But the button still act as it is save button however I change it’s #id.

Here is my button:

<a class="btn" id="save_post">Save Post</a>

When I click on edit button I change form values and also change #id of Save Post button;

$('#save_post').attr('id','edit_save_post');

After all, Firebug shows everything OK, #id changed.

<a class="btn" id="edit_save_post">Save Post</a>

But when I click on button it doesn’t run update db, it runs again save. How can I have browser forgot old #id?

Thanks,

  • 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-19T12:42:32+00:00Added an answer on May 19, 2026 at 12:42 pm

    You most likely bound your handlers using $('...').click(yourfunction);
    That binds them to the matching elements at this very moment.

    If you are adding/changing elements dynamically, use live events: $('...').live('click', yourfunction);

    Update:

    .live() is deprecated by now; use $(ancestor).on('click', 'selector', yourfunction) instead with ancestor being an element or selector that already exists and contains the related elements selected by selector; to mimic .live() you’d use document as the ancestor.

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

Sidebar

Related Questions

I know the subject was on the board many times, but i can not
I know that it's a subject that can raise a lot of debate, but
I am sorry for the subject, but I do not know how to match
Let me start by saying I know my subject is not exactly correct but
I know this subject was discussed here, but I really can't get this to
I read other questions about subject. I know what I should not rely on.
I know there are a lot of questions around on this subject, but I've
I know this SO question, but it deals with the subject in more general
I crawled google a lot to find some documentation on the subject but did
I know the subject might be a bit confusing, but in my searching i

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.