1

I have this JS code.

I want to show a "hand" cursor when I hover on the div like it would normally do for an a href.

$("#button1div").click(function(){
window.location = 'http://google.com';
});

How do I make the cursor change to a hand?

Thanks.

2
  • 4
    #button1div { cursor: pointer; } add this in your css. I think this'll help you. Commented Aug 7, 2012 at 10:26
  • I agree. No JavaScript needed. Commented Aug 7, 2012 at 10:31

2 Answers 2

4

While you seem to want to do this with Javascript, there is a much easier way to do it with CSS alone:

#button1div {
    cursor: pointer;
}

And, I'm not sure if you're really doing anything more than changing window.location when that div is clicked, but it looks like you could use an a element with no problem.

Sign up to request clarification or add additional context in comments.

Comments

1
$("#button1div").css('cursor','pointer');

will set the cursor as hand symbol.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.