Javascript Select option in Select box based on class
<p>I have a div that contains many classes. If the the div is clicked on and one of it's classes matches the value any option in the select box, i want that option to be selected. </p>

<pre><code>&lt;div class="abc cdf fff r10 yyy"&gt;
&lt;select id="whatever"&gt;
    &lt;option value="r10"&gt;test10&lt;/option&gt;
    &lt;option value="r20"&gt;test20&lt;/option&gt;
    &lt;option value="r30"&gt;test30&lt;/option&gt;
&lt;/select&gt;
</code></pre>

<p>How do i achieve this with JavaScript or jQuery
I tried the following but can't get it to work.</p>

<pre><code>var roundclasses = $(this).attr('class').split(/\s/); //This outputs the array of classes sucessfully
for (var i in roundclasses){
    $('#whatever').val(roundclasses[i]);
}
</code></pre>
