Lucas Ariel Enrich Lucas Ariel Enrich - 2 years ago 69
Javascript Question

How to remove a class on click event?

this is the html:

`





Prueba





</body>
</html> `


this the css:

.prueba{
height: 100px;
width: 100px;
background-color: green;
}

and this the js (EDITED):
`

var main=function(){
$('.prueba').click(function(){
$(this).removeClass('.prueba');
});

};

$(document).ready(main);


`

It (STILL) doesn't work. Can someone help me?

Answer Source

To select class, you should preface class name with a dot:

$('.prueba')

JQuery docs you may want to review.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download