$('div[symbol=GOOG][exchange[NASDAQ]').attr('tabindex')
it should do the trick
Question
I need to find the tab index and id of a tab that has two particular attributes. Here's an example tab:
<div id="tabs-2" aria-labelledby="ui-id-2" class="ui-tabs-panel ui-widget-content ui-corner-bottom" role="tabpanel" aria-expanded="true" aria-hidden="false" style="display: block;" tabcounter="2" symbol="GOOG" exchange="NASDAQ">
In this case, I want it to spit out the index as well as "tabs-2" when it identifies that the symbol is "GOOG" and the exchange is "NASDAQ".
Thanks.
Solution
$('div[symbol=GOOG][exchange[NASDAQ]').attr('tabindex')
it should do the trick
OTHER TIPS
To select an element based on attributes, use the "attributes selector"
var elem = $('[symbol="GOOG"][exchange="NASDAQ"]')
then to get the ID and index
var id = elem.prop('id');
var index = elem.index();