如何计算<a> listing as shown in results

时间:2018-06-29 00:33:10

标签: search hyperlink count append

I have been trying to work with this jquery script for 2 hours and nothing has improved throughout changes.

I have this result tab working now, and what I would like to add is the <div id="counts"></div> container that would show the total numbers of results being counted as they're shown up. Lets say there's one result the <div id="counts">1</div> container has "1", etc. If there's no result then leave container with "0".

IMAGE RUNDOWN BEFORE + AFTER

的总数

这是我当前的编码:

$('#search').on('change keyup', function() {
  checkForInput(this);  
   var rowCount = $('.product_listing.value a').length;
    document.getElementById('counts').innerHTML = rowCount;

});


<ul class="list-group no" id="result">
**<div id="counts"></div>**
<div class="product_listing">
<a>RESULT</a>
<a>RESULT</a>
<a>RESULT</a>
</div>
</ul>

0 个答案:

没有答案