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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T16:28:29+00:00 2026-06-13T16:28:29+00:00

I am not sure what i am doing wrong here.i have a div and

  • 0

I am not sure what i am doing wrong here.i have a div and i want to open up a popup if user hover over that div section and want to close on mouseout. here is my code

<div class="topCart">
  some data
</div>

this is my JQuery code

$(".topCart").mouseover(function() {
    $.get('${rolloverPopupUrl}?bustcache=' + new Date().getTime(),
     function(result) {
        $('#viewCart').html(result);
        refreshMiniCart();
        });
    $('#viewCart').slideDown('slow');
    }).mouseout(function() {
     $('#viewCart').slideUp('fast');
   });

above code is not working nor its giving any Ajax call to fetch fresh data, while if i use following code

$(document).ready(function(){
   $(".topCart").hover( function () {
    $('#viewCart').html("");
    $.get('${rolloverPopupUrl}?bustcache='+new Date().getTime(), function(result){
    $('#viewCart').html(result);
     refreshMiniCart();
    });
     if($('#viewCart').is(':hidden')){
        $('#viewCart').slideDown('slow'); }
        },
        function () {
            $('#viewCart').slideUp('fast');
        });
});

this piece of code is working and its fetching data so i do not see use of document.ready
with my limited knowledge of Jquery i tried but not able to see the reason of not working of code
can any one point me my error?

  • 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-13T16:28:32+00:00Added an answer on June 13, 2026 at 4:28 pm

    Try having some basic structure and cleanliness (which is next to godliness) when typing your code, and spotting errors will be much easier:

    $(function() {
        $(".topCart").on({
            mouseenter: function() {
                var elem = $('#viewCart');
                elem.empty();        
                $.get('${rolloverPopupUrl}?bustcache=' + new Date().getTime(), function(result) {
                    elem.html(result);
                    refreshMiniCart();
                });
                if (!elem.is(':visible')) elem.slideDown('slow');
            },
            mouseleave: function() {
                $('#viewCart').slideUp('fast');
            }
        });
    });​
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Not sure what I'm doing wrong here. I have a struct that is used
I'm not sure what I'm doing wrong here... I have a custom HashTable that
I'm not sure what I'm doing wrong here, I have a file in lib/acts_as_votable.rb
Im not quite sure what I am doing wrong here, I have folloed the
I have a feeling I'm doing something wrong here, but I'm not quite sure
I'm not sure what I am doing wrong here. I have some basic markup.
Not sure what I'm doing wrong here, but say I have: foo.h class foo
I'm not sure what I'm doing wrong here. I have a generic class, which
Not sure what I am doing wrong here. I am hoping that it is
I'm not sure what I'm doing wrong here, but I have a synatx error

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.