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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T13:42:24+00:00 2026-05-28T13:42:24+00:00

Not sure if this is posible or not, but I’m trying to use JavaScript

  • 0

Not sure if this is posible or not, but I’m trying to use JavaScript that I loaded via a script tag when the page was initially requested on dynamic HTML that was loaded via jQuery’s load() function.

Example: http://jsfiddle.net/3MR43/

As you can see in the example, after clicking a link in the pop up box, the link goes. The problem is that the link was suppose to be stopped, and you were suppose to see an alert.

However, if I paste the HTML that I am loading via jQuery, it works, so the code is fine.

  • 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-28T13:42:25+00:00Added an answer on May 28, 2026 at 1:42 pm

    Description

    You need jQuery .live() or .on() method to bind events to dynamically created html.

    Choose .live() or .on() depending on the version of jQuery you are using.

    .live() Available since jQuery 1.3. Attach an event handler for all elements which match the current selector, now and in the future.

    .on() Available since jQuery 1.7. Attach an event handler function for one or more events to the selected elements.

    Check out my sample and this jsFiddle Demonstration

    Sample

    … for jQuery.live()

    $('.lang').live("click", function(e) {   
        e.preventDefault();  
        alert('Testing..');        
    });
    

    … for jQuery.on()

    $('.lang').on("click", function(e) {   
        e.preventDefault();  
        alert('Testing..');        
    });
    

    More Information

    • jsFiddle Demonstration
    • jQuery.live()
    • jQuery.on()
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Not sure this is possible, but looking to write a script that would return
I am not sure if this is possible but I am trying to come
not sure if this is possible but, can you style a single tag within
Greetings all, I'm not sure if this is possible but I'd like to use
I'm not sure if this is possible but I want to use mod_rewrite like
I'm not sure this is possible, but I'm trying to pull a YouTube video
Possible Duplicate: jQuery/Javascript to replace broken images Not sure how possible this is but
I'm not sure if this is possible but I want to see objects created
I'm not sure if this is possible but I'd like to be able to
I'm not sure if this is possible but as I was looking for a

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.