4

Possible Duplicate:
Jquery css: applying !important styles

I have the following code:

$("body")
    .ajaxStart(function () {
        $(this).css({ 'cursor': 'progress' })
    })
    .ajaxStop(function () {
        $(this).css({ 'cursor': 'default' })
    });

This works but not when I hover over a link where I have a hover and a different cursor. Is there a way that I can set the CSS cursor property above to important with jQuery>

Community
  • 1
  • 1
Samantha J T Star
  • 30,952
  • 84
  • 245
  • 427

4 Answers4

6

Try this code for example:

$(this).css({ 'cursor': 'default !important' })
Alessandro Minoccheri
  • 35,521
  • 22
  • 122
  • 171
3
$("body")
.ajaxStart(function () {
    $(this).css({ 'cursor': 'progress !important' })
})
.ajaxStop(function () {
    $(this).css({ 'cursor': 'default !important' })
});
thecodeparadox
  • 86,271
  • 21
  • 138
  • 164
2

Just add !important after your property value:

$("body")
    .ajaxStart(function () {
        $(this).css({ 'cursor': 'progress !important' })
    })
     .ajaxStop(function () {
        $(this).css({ 'cursor': 'default  !important' })
   });
thecodeparadox
  • 86,271
  • 21
  • 138
  • 164
GajendraSinghParihar
  • 9,051
  • 11
  • 36
  • 64
1

This is the syntax,

How to apply !important using .css()?

Community
  • 1
  • 1
Vivek S
  • 5,384
  • 8
  • 51
  • 72