通过标题获取元素jQuery [英] Get element by title jQuery
本文介绍了通过标题获取元素jQuery的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经搜索过,但无法找到通过标题获取元素的jQuery选择器。所以我会尝试在标题=='cars'的下拉菜单上处理。
例如:
< select title ='cars'>
< option value =volvo>沃尔沃< / option>
< option value =saab> Saab< / option>
< option value =mercedes> Mercedes< / option>
< option value =audi> Audi< / option>
< / select>
非常感谢,
解决方案
使用属性等于选择器,如下所示:
$(select [title ='cars'])
还有其他属性选择器如果需要,也可以使用:)
I have searched but cannot find the jQuery selector that gets an element by a title. So I would be trying to get a handle on the dropdown with title =='cars'
Eg:
<select title='cars'>
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="mercedes">Mercedes</option>
<option value="audi">Audi</option>
</select>
Thanks alot,
解决方案
Use the attribute-equals selector, like this:
$("select[title='cars']")
There are other attribute selectors available as well if the need arises :)
这篇关于通过标题获取元素jQuery的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文