JSFiddle - React, Tailwind, and code Playground

by kasperfish

HTML

<div>
  <div class="test"><p>1</p><p>1</p></div>
  <div class="test"><p>1</p><p>1</p><p>1</p></div>
</div>

JavaScript

$.fn.mycount = function() {
    var curr = $(this);
    for(var i=0; i<curr.length; i++){
        var x = $(curr[i]).find('p').length;
        console.log('result is : ' + x*2);
    }
};

$('.test').mycount();