Attribute Equals Selector [name=”value”]
Attribute Equals Selector [name=”value”]
attributeEquals selector
Description: Selects elements that have the specified attribute with a value exactly equal to a certain value.
-
version added: 1.0jQuery( "[attribute='value']" )
attribute: An attribute name.
value: An attribute value. Can be either a valid identifier or a quoted string.
$selector.find("[data-val=true]").each(function () { $jQval.unobtrusive.parseElement(this, true); });
Attribute Contains Selector [name*=”value”]
attributeContains selector
Description: Selects elements that have the specified attribute with a value containing a given substring.
-
version added: 1.0jQuery( "[attribute*='value']" )
attribute: An attribute name.
value: An attribute value. Can be either a valid identifier or a quoted string.
This is the most generous of the jQuery attribute selectors that match against a value. It will select an element if the selector's string appears anywhere within the element's attribute value. Compare this selector with the Attribute Contains Word selector (e.g. [attr~="word"]), which is more appropriate in many cases.
Example:
Finds all inputs with a name attribute that contains 'man' and sets the value with some text.
<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>attributeContains demo</title> <script src="https://code.jquery.com/jquery-3.5.0.js"></script> </head> <body> <input name="man-news"> <input name="milkman"> <input name="letterman2"> <input name="newmilk"> <script> $( "input[name*='man']" ).val( "has man in it!" ); </script> </body> </html>
只有前面三个input里面会有字符串"has man in it",第四个是没有的
attribute-selectors
作者:Chuck Lu GitHub |
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
2018-05-18 innerxml and outerxml
2017-05-18 查看以及改变文件的编码格式
2017-05-18 difference in physical path, root path, virutal path, relative virtual path, application path and aboslute path?
2017-05-18 Anatomy of an IIS7 configuration path
2017-05-18 Understanding IIS Bindings, Websites, Virtual Directories, and lastly Application Pools
2017-05-18 netsh http的使用
2016-05-18 string[][]和string[,] 以及 int[][]和int[,]