Get div id using javascript
<p>Here's some HTML:</p>

<pre><code>&lt;div class="results"&gt;
  &lt;div id="1"&gt;something&lt;/div&gt;
  &lt;div id="2"&gt;something else&lt;/div&gt;
  &lt;div id="3"&gt;blah blah blah&lt;/div&gt;
  &lt;div id="4"&gt;etc&lt;/div&gt;
&lt;/div&gt;
</code></pre>

<p>Now if I can call this using jQuery:</p>

<pre><code>var div = $(".results &gt; div");
div.click(function()
{
  alert(this.childNodes[0].nodeValue);
});
</code></pre>

<p>When clicking on a div, it will call an alert box saying whats in the div (from the list above: one of 'something', 'something else', 'blah blah blah' or 'etc'). Does anyone know how I can get it to alert the id (in this example, 1, 2, 3 or 4) of the div rather than the information within the node?</p>

<p>Thanks</p>
