Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use a dot in a class name within jquery: $('.B.Avf').toggle();

Is it possible to use a dot in a classname inside Jquery?

$('.B.Avf').toggle();

I need to keep the dot in: B.Avf classname.
Can i somehow escape it?
Is this possible?

UPDATE

I tried to escape it with "\" with no success.

like image 513
Björn C Avatar asked Oct 24 '25 14:10

Björn C


1 Answers

You can always just use the [attr="val"] selector for this.

$('[class*="B.Avf"]')

The *= means "class contains...". Since this is looking at the attribute directly and there could be more than one class, you don't want to use =.

like image 113
Rocket Hazmat Avatar answered Oct 27 '25 07:10

Rocket Hazmat