1

I have a little button which i want to rotate when i click on it. I tried the most direct way, which in my opinion is:

$(this).rotate(45);

This is the way it looks in my code:

$(document).ready(function() {    
    $(function() {
        $('.fa-plus-circle').click(function() {    
            $(this).rotate(45);   
        });
    });
});

I went to my browser and opened the console and this is what i saw there:

console error

I tried changing the jquery library from the latest to 1.7.2, that didn't work either. I tried using something different after, I used

$(this)slideUp

And yup, that worked for some reason. It seems to have trouble with "rotate".

Thanks in advance,

Kevin

https://jsfiddle.net/exm8gkbd/

Pranav C Balan
  • 113,687
  • 23
  • 165
  • 188
Madses
  • 23
  • 1
  • 5

1 Answers1

3

There is no method like rotate() in jQuery. You need to use css() method to apply transform.

$(this).css('transform','rotate(45deg)');
Pranav C Balan
  • 113,687
  • 23
  • 165
  • 188