什么是“^ =” (caret equals)在jquery中意味着什么? [英] What does "^=" (caret equals) mean in jquery?

查看:87
本文介绍了什么是“^ =” (caret equals)在jquery中意味着什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下内容隐藏了ID中包含 Stud_Btn 的图片。

The following hides images that have Stud_Btn in their id.

$('img[id^="Stud_Btn"]').hide();

即使我有 Stud_Btn1234 Stud_Btn234 ,它仍会隐藏它。 ^究竟意味着什么?

even if I have Stud_Btn1234 and Stud_Btn234, it will still hide it. What does "^" really mean?

它不仅可以用于比较吗?或者它有其他用途吗?

Can it not only be used for comparison? Or does it have other uses?

推荐答案

[attr ^ = val] 一个CSS选择器,意思是:

[attr^=val] a CSS selector that means:


具有名为 attr 属性的元素以 val 开头的值。

Element that has an attribute named attr with a value that starts with val.

类似于 [attr $ = val] ,相反,查找以 val 结尾的属性。

It's similar to [attr$=val], which does the opposite, looking for an attribute ending with val.

这篇关于什么是“^ =” (caret equals)在jquery中意味着什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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