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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:47:26+00:00 2026-05-27T03:47:26+00:00

I have a listener on DOMContentLoaded which calls startup() function. I want to add

  • 0

I have a listener on DOMContentLoaded which calls startup() function.

I want to add more listeners (within the startup function) to items added to the DOM in the startup function. But it seems to fail (no click event registetered)

I use item.addEventListener("click", f, false); where f is the function that is supposed to run.

NOTE: I CANNOT use onclick=… I also cannot use JQuery.

Demo code is here

  • 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-27T03:47:27+00:00Added an answer on May 27, 2026 at 3:47 am

    You have several issues in your code:

    1. previous function is not defined
    2. To attach a click event via addEventListener, the event name is click not onclick.
    3. You are calling addListeners outside of your load function.

    Here is a jsfiddle that works: http://jsfiddle.net/VUgRu/

    You should always use the javascript console to see what errors you are getting.

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

Sidebar

Related Questions

I have a listener like this: $('.delete').click(function() { ...some stuff }); Also, on the
I have a listener for click events from which I need to exclude some
I have a simple gateway listener which generates a log at the screen output
I have a Listener class which implements ViewListener (contains two methods, open, close, which
I have a listener which contains a preSave() method. Is there a way for
I've a text field which extends javax.swing.JTextField and also have document listener like this
I have a listener inside Class A, and I want to pass Class A
Currently I have this listener event on my google maps: google.maps.event.addListener(map, 'dragend', function() {
I want to have a listener for a socket at the client side. I
I have a listener: listener = new HttpListener(); listener.Prefixes.Add(@http://+:8077/); listener.Start(); listenerThread = new Thread(HandleRequests);

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.