Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Javascript Hover Cursor Pointer

Tags:

jquery

css

hover

Trying to use Jquery to do a Cursor Pointer on hover:

$('#example td').hover(function() {
$(this).css('cursor','pointer');
});

I do not want to put it in CSS, I want it in Jquery.

What do I need to do to fix this?

http://jsfiddle.net/Egttj/

like image 330
DJ Howarth Avatar asked Dec 30 '12 17:12

DJ Howarth


People also ask

What is cursor hover?

Alternatively referred to as mouseover or mouse hover, hover describes the act of moving a mouse pointer over a clickable object, but not actually clicking the left or right mouse button. For example, when you hover your mouse over any of the links on this page, they should change color, indicating they can be clicked.

How do you change the cursor into a hand when a user hovers over a list item?

How to make the cursor to hand when a user hovers over a list item using CSS? Use CSS property to create cursor to hand when user hovers over the list of items. First create list of items using HTML <ul> and <li> tag and then use CSS property :hover to cursor:grab; to make cursor to hand hover the list of items.

How will you change the pointer icon when it goes over an a tag?

The default cursor for a hyperlink is "pointer". To change it, you need to specify the cursor type for your <a> element with the CSS :hover selector.


1 Answers

It seems to work here after I cleared up your jquery, you forgot to close the first click function and the searchform and button aren't declared in your html (i changed it to #example tr)

Basically your jQuery wasn't that well coded (there also was a line with 5.}) on it that didn't belong there).

I also set the "your framework" to jQuery instead of the standard selected mooTools

This is the complete jQuery code I got after i deleted some unnecessary code:

$(document).ready(function() {

    $('#example tr').click(function() {
        var href = $(this).find("a").attr("href");
        if(href) {
            window.location = href;
        }
    });

    $('#example tr').hover(function() {
        $(this).css('cursor','pointer');
    });

});

Fiddle

like image 154
Hans Vn Avatar answered Oct 01 '22 19:10

Hans Vn