How to get a class name based on div hover in jquery
<p>I'm looking for a way to fetch the class name based on hovering on a div. Both div has same id but slightly different class name. take a look at the below example:</p>

<pre><code>&lt;div id="1-someid" class="1-example-class border cz"&gt;
...more element goes here....
&lt;/div&gt;
</code></pre>

<p>and </p>

<pre><code>&lt;div id="2-someid" class="2-example-class border cz"&gt;
...more element goes here....
&lt;/div&gt;
</code></pre>

<p><strong>Update:</strong> I've made the id name unique based on expert's opinion posted below. :) Thanks for all the helps.</p>

<p>Now what I want is, when user hover on the div with <code>1-example-class</code> it will return me the class name <code>1-example-class</code>. and when people will hover on the div with <code>2-example-class</code> it will return me <code>2-example-class</code> name.</p>

<p>So that I can use <code>parseInt()</code> on that name to fetch the number, 1, 2, 3 and so on.</p>

<p>Also please note that writing a static script for just <code>1-example-class</code> or <code>2-example-class</code> will not help as there are many more divs like this with 3, 4, 5 and so on attached to it.</p>

<p>Can anyone help? I have tried the following but it didn't helped.</p>

<pre><code>$('#someid').hover(function() {
        var class_names = $(this).attr('class');

        var class_name = class_names.split( ' ' ); 

        var c = parseInt( class_name[0] );

        console.log( c );
});
</code></pre>

<p>If anyone can help it will be really helpful.</p>