在jquery中使用类名中的点:$('。B.Avf')。toggle(); [英] Use a dot in a class name within jquery: $('.B.Avf').toggle();

查看:105
本文介绍了在jquery中使用类名中的点:$('。B.Avf')。toggle();的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在Jquery中的类名中使用点?

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

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

我需要保持点:B.Avf classname。

Can我以某种方式逃脱它?

这可能吗?

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

更新

我试图用\来逃避它但没有成功。

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

推荐答案

你总是可以使用 [attr =val] 此选择器。

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

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

* = 表示 class 包含...。由于这是直接查看属性并且可能有多个类,因此您不想使用 =

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 =.

这篇关于在jquery中使用类名中的点:$('。B.Avf')。toggle();的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆