Link to home
Start Free TrialLog in
Avatar of tf2012
tf2012

asked on

Find an element in dom with jquery

I'm trying to write a bit of script using jquery that will return the h3.the-thing-title text where the sibling selected option value is 6.  In other words I'm trying to get h3 text where the adjacent select has 6 selected.
$('.blue').find('.house-number[value="6"][selected="selected"]') and it's not even close to working.  Any ideas how
I can do this?  I just need to get the h3 text which would be Derp 2 in this case.

<div class="blue">
    <div class="the-thing">
        <h3 class="the-thing-title">Derp 1</h3>
        <div class="col-four">
            <select class='house-number'>
                <option value="0">Zero</option>
                <option value="1">One</option>
                <option value="2">Two</option>
                <option value="3" selected="selected">Three</option>
                <option value="4">Four</option>
                <option value="5">Five</option>
                <option value="6">Six</option>
            </select>
        </div>
    </div>
</div>
<div class="blue">
    <div class="the-thing">
        <h3 class="the-thing-title">Derp 2</h3>
        <div class="col-four">
            <select class='house-number'>
                <option value="0">Zero</option>
                <option value="1">One</option>
                <option value="2">Two</option>
                <option value="3">Three</option>
                <option value="4">Four</option>
                <option value="5">Five</option>
                <option value="6" selected="selected">Six</option>
            </select>
        </div>
    </div>
</div>
<div class="blue">
    <div class="the-thing">
        <h3 class="the-thing-title">Derp 3</h3>
        <div class="col-four">
            <select class='house-number'>
                <option value="0">Zero</option>
                <option value="1" selected="selected">One</option>
                <option value="2">Two</option>
                <option value="3">Three</option>
                <option value="4">Four</option>
                <option value="5">Five</option>
                <option value="6">Six</option>
            </select>
        </div>
    </div>
</div>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Julian Hansen
Julian Hansen
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of tf2012
tf2012

ASKER

Thank you I'll give it a shot!