I would like to target the following attribute value: data-search-position
<div id="result-item-1" class="search-item " data-search-position="1">
<div class='item-colours-result'>
<ul class='list-class'><li>1</li><ul>
</div>
</div>
<div id="result-item-2" class="search-item " data-search-position="2">
<div class='item-colours-result'>
<ul class='list-class'><li>1</li><ul>
</div>
</div>
As the data-search-position
will define how many list items it will have, I need to find out how to do that. I have the following so far but it's no good:
$(document).ready(function () {
var colorCount = $('#result-item-1 .item-colours-result ul li');
if (colorCount.length > 0) {
// do something
}
else {
//do something
}
});