What is the Javascript for changing the css on an element?

buddy123456

New Member
I have a JSFiddle example I can't get working:http://jsfiddle.net/KDVvN/17/ (updated to include jQuery)I want the element to have an open hand when moused over (which works) and a closed hand when the mouse is clicked on it (which I can't get to work).I know I am doing something wrong in the javascript. Can anyone help?Javascript:\[code\] $(function () { $(".dragbox h2").on("mousedown", function (evt) { $('.dragbox h2').addClass('grabbing'); }).on("mouseup", function (evt) { $('.dragbox h2').removeClass('grabbing'); }); });\[/code\]CSS:\[code\].dragbox { margin:0px 2px 2px; background:#fff; position:relative;}.dragbox h2 { font-size:15px; cursor: grab; cursor:-webkit-grab; cursor:-moz-grab; cursor: url(https://mail.google.com/mail/images/2/openhand.cur), default !important;}.dragbox h2.grabbing { cursor: grabbing; cursor:-webkit-grabbing; cursor:-moz-grabbing; cursor: url(https://mail.google.com/mail/images/2/closedhand.cur), default !important;}\[/code\]
 
Top