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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T05:36:42+00:00 2026-06-13T05:36:42+00:00

Possible Duplicate: jquery click doesnt work on ajax generated content The issue is that

  • 0

Possible Duplicate:
jquery click doesnt work on ajax generated content

The issue is that I need to perform a JQuery on click function to an <a> tag created from an Ajax get. I can’t seem to find an answer that works for me.

$("#get_button").click(function (e) {
   $.ajax({
     type: 'GET',
     url: 'http://someurl.com/apikey=1234124124',
     dataType: 'jsonp',
     success: function (data) {
       newRow = "<a id='some_id'>test</a>";
       $("#table_id").append(newRow);
     }
  });
});
$('#some_id').click(function (event) {
    event.preventDefault();
    alert('this will pop up if it worked');
});

Edit for clarification: In my code there are multiple rows added with the id of some_id, I forgot to show that.

  • 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-06-13T05:36:43+00:00Added an answer on June 13, 2026 at 5:36 am

    you really need to research these types of questions before asking , if you are using newer jquery (i think 1.6 and above ) it is :

    $(document).on("click", '#some_id', function (event) {
        event.preventDefault();
        alert('this will pop up if it worked');
    });
    

    older versions use .live() instead of .on()

    For the edit in your question – DO NOT have multiple elements with the same id , give them the same class , you can dynamically create ids and add something to each one if you want , like #some_id0 #some_id1 ect…

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

Sidebar

Related Questions

Possible Duplicate: JQuery ajax cross domain I need to load content from another websites
Possible Duplicate: jquery on vs click methods I understand that $(parent).on('click', 'element', function(){ ...
Possible Duplicate: jQuery ajax return value I have this jQuery script: $('#headerSubmit').click(function() { var
Possible Duplicate: jQuery click not working for dynamically created items $(document).ready(function(){ $('#btn').click(function(){ var createInput=$(<input
Possible Duplicate: jquery .click pass parameters to user function $('#topleft').click(function (x) { loadPopupBox(); $(#popupinner).load('getdetail.php?id='
Possible Duplicate: Click trigger on select box doesn't work in jQuery I am trying
Possible Duplicate: jQuery : simulating a click on a <input type=“file” /> doesn't work
Possible Duplicate: Jquery event chaining Traditionally we may write: $(selector).click(function () { }); but
Possible Duplicate: jQuery ajax error function I am trying to replace a global ajax
Possible Duplicate: How pass variable in jquery easy confirm Pass variable to click function

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.