Within a container with two styles, the initial nested div
<div class="datacheck">
<div class="classic_div_data customdataid_305">
some values are included here
</div>
<div class="optiondiv">
</div>
</div>
I am looking to extract a substring (in this case the number 305) from the second style (customdataid_305
) of the first inner div. To accomplish this, I require access to the classes.
I managed to achieve this using jQuery
var xyz= $($(".datacheck").find("div")[0]).attr("class").split(" ")[1]
which allows me to retrieve the class.
Is there a more straightforward method for accomplishing this?
I am hoping for something similar to $(element).class()
that potentially returns an array of classes