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

LVL 1
tf2012Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Julian HansenCommented:
This should work
<script>
$(function() {
  $('.blue option:selected').each(function(i, e) {
    if (e.value == 6) {
      var text = $(e).closest('.the-thing').find('h3').text();
      console.log(text);
    }
  });
});
</script>

Open in new window

The script loops through all option elements that are children of elements with the class .blue and that are selected and tests their value to see if it is 6.
When one is found it then reverse traverses the tree using closest() to find the closest ancestor with class .the-thing. From there we use .find() to find the <h3> and return its text.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
tf2012Author Commented:
Thank you I'll give it a shot!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.