views:

84

answers:

1

Hi,

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,

+13  A: 

Use the attribute-equals selector, like this:

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

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

Nick Craver
Thanks Nick, sorry took so long to mark as answer, i thought it wasn't working in I.E 6 but thats because i had a console.log message throwing a javascript error! Many Thanks
nav