Link to home
Start Free TrialLog in
Avatar of newbie29
newbie29

asked on

mouse cursor

Hello,
Can someone please let me know how I can change the mouse cursor to hand (as in hyper links) on hover to the image tag using jquery syntax
Please advice
regards
sam
Avatar of JohnSixkiller
JohnSixkiller
Flag of Czechia image

Javascript:

OBJECT.style.cursor = 'hand';
Avatar of newbie29
newbie29

ASKER

any jquery syntax please?
ASKER CERTIFIED SOLUTION
Avatar of JohnSixkiller
JohnSixkiller
Flag of Czechia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
thanks for your help john.....i keep this open to get better jquery syntax
Complete solution with correct jQuery syntax:
<style type="text/css">
  .cursor_pointer {
    cursor:pointer;
  }
</style>
 
<script type="text/javascript">                                         
  $(function() {
    $('img').click(
                function() {
                    alert("Hello world!");
                  }
                )
                .hover(
                  function(){
                    $(this).addClass("cursor_pointer");
                  },
                  function(){
                    $(this).removeClass("cursor_pointer");
                  } 
                );
  }
</script>

Open in new window

I have found a smaller solution:

$(selector).hover(function() {
$(selector).css("cursor","pointer");
});

Works fine on my site...