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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T05:54:29+00:00 2026-06-16T05:54:29+00:00

I have this HTML: <html> <head> <title>Mouseenter and Click combined</title> </head> <body> <a id=linkselector

  • 0

I have this HTML:

<html>
<head>
<title>Mouseenter and Click combined</title>
</head>
<body>
<a id="linkselector" href="#">Click here</a>
</body>
</html>

This is my jQuery code:

jQuery( document ).ready( function($) {

//This is the click event
$('#linkselector').live('click',(function() {        

alert('You are clicked!');


}));

//This is the mouseover event
$('#linkselector').live('mouseenter', (function(evt){

    $('<div class="popupx"></div>').appendTo(document.body);
    $('.popupx').html('<img src="http://' + $(this).data('id') + '.jpg.to/">');
    $('.popupx').css({left: evt.pageX+30, top: evt.pageY-15}).show();
    $('.popupx').css('border','0');        

    $(this).live('mouseleave', (function(){
        $('.popupx').hide();
    }));
}));

});

And finally my CSS:

.popupx{
position:absolute;
width:30px;
height:30px;
}
.popupx img{
width:30px;
height:30px;
}

When I hover the link, the image correctly displays so its working. The problem is that when I click on it, it does not anymore trigger the click event. However if I remove the mouseenter/hover mechanism. The click event works fine.

How is it possible to have the click event fire when the user mouse over the link? Probably I miss something important in my code. Thanks for any tips.

UPDATE: I have successfully combined the three events in one function but I’m still using LIVE and IF/else because for some reason ON won’t work. Anyway, I have mouseenter and mouseleave working correctly in the logic below. But click still won’t work when mouseenter is activated. Probably I need to find a way that the click event will fire when the hover or mouseenter event is still shown.

    $('#linkselector').live('click mouseleave mouseenter',(function(evt) {  

    if (evt.type === 'click') {
//This is a click event
    //This won't fire when the mouseenter or hover is shown

} else if (evt.type === 'mouseenter') { 

            //This is working nicely

        $('<div class="popupx"></div>').appendTo(document.body);
        $('.popupx').html('<img src="/image.png">');
        $('.popupx').css({left: evt.pageX-60, top: evt.pageY-60}).show();
        $('.popupx').css('border','0');

} else if (evt.type === 'mouseleave') {

         //This is also working nicely

        $('.popupx').remove();      

    }

}));
  • 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-16T05:54:31+00:00Added an answer on June 16, 2026 at 5:54 am

    Your code works fine in jQuery 1.7.2 & firefox 17.
    What is your jQuery version & browser?

    I copy & paste your code here:
    jsfiddle.net/62Y64/

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

Sidebar

Related Questions

I have this html code <html> <head> <title>JQuery Problem 2</title> <script type=text/javascript src=jquery-1.4.min.js></script> <script
I have this HTML Code: <!doctype html> <html> <head> <meta charset=utf-8> <title>Untitled Document</title> <link
I have this HTML code: <HTML> <HEAD> <TITLE></TITLE> </HEAD> <BODY> <form action=http://www.aweber.com/scripts/addlead.pl method=post> <input
I have this code: <!DOCTYPE html> <html> <head> <title>@ViewBag.Title</title> <link href=@Url.Content(~/Content/Site.css) rel=stylesheet type=text/css />
Let's have a look at this HTML code: <!DOCTYPE html> <html> <head> <title>Test</title> </head>
OK i have this code HTML: <html> <head> <script type=text/javascript src=http://code.jquery.com/jquery-1.7.1.min.js> </script> <script type=text/javascript>
I have this code <html> <head> <script src=jquery-1.7.2.min.js type=text/javascript></script> <script src=jquery-ui-1.8.20.custom.min.js type=text/javascript></script> <script type
Ok, I have this code: <html> <head> <script type=text/javascript src=http://code.jquery.com/jquery-1.7.1.min.js></script> <script type=text/javascript> function get()
Say I have this HTML: <html> <head> <title>Hello [[USER_FIRST_NAME]]</title> </head> <body> <p>Hi, [[USER_FIRST_NAME]] [[USER_LAST_NAME]]!</p>
So i have this code: <html> <head> <title>Form</title> <script type=text/javascript> function showConfirmationDialog() { var

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.