Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jquery events does not work

I'am trying to change the class of some input elements during some mouse events but only mouseover and mouseout events are working, what can be the reason of this problem ?

    $(document).ready(function(){
       $('.registerFormElements').mouseover(function(){
               this.className='bright';
       });
       $('.registerFormElements').mouseout(function(){
               this.className='';
       });
       $('.registerFormElements').focus(function(){
           this.className='bright';
       });
       $('.registerFormElements').blur(function(){
           this.className='';
       });
    });
like image 317
Tartar Avatar asked Jan 18 '26 14:01

Tartar


1 Answers

Try to use the code :

$(this).attr('class', '');

or

$(this).attr('class', 'myClass');

and you can too

$(this).addClass('myClass');
$(this).removeClass('myClass');
like image 103
David 'mArm' Ansermot Avatar answered Jan 20 '26 02:01

David 'mArm' Ansermot



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!