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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T01:58:27+00:00 2026-06-13T01:58:27+00:00

I have a simple set of jQuery statements for a particular class: $(.printersToggle).mouseover(function() {

  • 0

I have a simple set of jQuery statements for a particular class:

$(".printersToggle").mouseover(function() { 
    $(this).addClass("printersToggleOver");
}); 
$(".printersToggle").mouseout(function() { 
    $(this).removeClass("printersToggleOver");
});

and:

$(".printersToggle").click(function() {
    var id = $(this).attr('id');
    $.getJSON("/ajax", 
            function(data) {
                $.each(data, function(key, val) { 
                    $("#" + id).replaceWith('<div class="row printersToggle" id="' + id '"><div class="twelve columns">Show printers (Best price: £4.65)</div></div><!-- end of printers toggle --><!-- printers --><div class="row" id="printers"><table><thead><tr><th>Title</th><th>Rating (%)</th><th>Experience (jobs)</th><th>Average job speed (days)</th><th>Reliability (%)</th><th>Cost</th><th>Print</th></tr></thead><tbody><tr><td id="printersName_{{ design.id }}"></td><td id="printersRating"></td><td>4</td><td>2</td><td>96</td><td>£4.56</td><td class="success printButton radius">Add to Cart</td></tr></tbody></table></div>');  
                });
            });
     });
}); 

Without the second one (the click function), the first works as intended. With the second statement, the mouseover effects stop working. Any idea what’s going on 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-06-13T01:58:28+00:00Added an answer on June 13, 2026 at 1:58 am

    When you call replaceWith(), you are removing the previous DOM element along with any event handlers associated with it. You should use on() with a selector to bind the event handler dynamically:

    $('#parentContainer').on('mouseover', '.printersToggle', function() { ... });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some simple jQuery toggle script like this: <script type=text/javascript> $(document).ready(function() { $('#clickedit').click(function()
I have a simple HTML page with these jQuery statements: $(document).ready(function() { $('#myDiv').load('mypage.html'); });
What I am trying to do: I have a simple set union function in
I have a simple problem with SQL SERVER charindex function. DECLARE @VAR1 varchar SET
I have a simple jquery script as follows: $('a').click(function() { //get the id of
Hi i have a simple accordion set up with jQuery with the HTML structure
I have a very simple .NET MVC3 project set up using jquery mobile for
I have this simple jQuery code to test out. <html> <head> <script type=text/javascript src=jquery.js></script>
I have a simple JQuery UI tabs menu working, and I set it up
I have a simple page with two lists. Using jQuery I have set the

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.