Get element by title jQuery

2019-01-11 06:25发布

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,

1条回答
▲ chillily
2楼-- · 2019-01-11 06:59

Use the attribute-equals selector, like this:

$("select[title='cars']")

There are other attribute selectors available as well if the need arises :)

查看更多
登录 后发表回答