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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T09:55:38+00:00 2026-06-06T09:55:38+00:00

My code has uses jquery to add an element to a page, and then

  • 0

My code has uses jquery to add an element to a page, and then add a ‘click’ event to it. The code is:

$('.photosItem').mouseover(function() {
        // Remove all existing comment buttons
        $('.reelPhotoPageCommentLink').remove();
        // Add a comment button
        var commentButton = "<div class='reelPhotoPageCommentLink'>";
        commentButton += "Comment";
        commentButton += "</div>";
        $(this).prepend(commentButton);
        // Add click event to comment button
        $('.reelPhotoPageCommentLink').click(function() {
            $('#editPopupForm').remove();
            // Get photo id
            var photoID = $(this).parent().attr('photo_id');
            var url = "get_photo_comment_form/" + photoID;
            $.ajax({ 
                url: url,
                type: "POST",
                success: function(data) {
                    // Add item after header
                    $('#header').after(data);
                }
            });
        });
    });

So, when you hover over a photo with class “photosItem”, a ‘comment’ button appears. Clicking on the button pops up the comment box. This works fine on Firefox, but I’m having trouble on Chrome, which doesn’t seem to pick up the click event. It adds the comment button when I hover, but clicking it doesn’t do anything. There are no errors in the console at any stage.

I added a console.log after $(‘.reelPhotoPageCommentLink’).click(function() {, and it’s not showing up, so it looks like the click event is being ignored.

Anyone have any ideas how I can get this to work? It’s fine in Firefox, and there are no warnings or errors there.

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-06-06T09:55:40+00:00Added an answer on June 6, 2026 at 9:55 am

    I gave up on this in the end.

    Instead, I’ve generated the buttons with the click events when the page loads, but kept them hidden. The rollover then shows the buttons rather than generating them.

    Thanks for the help codeparadox and Malevolence. It’s also handy to know about jsfiddle – I’m sure I’ll use that again.

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

Sidebar

Related Questions

I have some jquery code that uses the live method of triggering events: $(document).ready(function()
Code has been amended and now it works as follows when you click on
I'm working on a page that has both Mootools 1.4 and jQuery 1.5.1 running.
While debugging a javascript code that uses jQuery I found the following code: [0,
I have a page that uses the jQuery.swfobject plugin to embed 5 flash items
Here's my conundrum: I have a page that uses Google Maps V3 and jQuery.
Working on a project which uses Jquery(1.6) Tabs, works all good but wondering if
Ok I have a page that uses 3 plugins and custom code. Fullscreenr ScrollTo
I am working on an application that uses JQuery Mobile . My application has
I am trying to build a page that uses jQuery to call a database

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.