JSFiddle - React, Tailwind, and code Playground

by JAAulde

HTML

<div class="tabWrapper contains">
   <a class="active" data-paramvalue="Equities" href="javascript:void(0);">Stocks (10)</a>
   <a data-paramvalue="ETFs" href="javascript:void(0);">ETFs (15)</a>
   <a href="javascript:void(0);" data-paramvalue="Mutual Funds" class="last">Mutual Funds (5)</a>
</div>

JavaScript

var total = 0,
    parenthesizedDigitPttrn = /\((\d+)\)/;

$( '.tabWrapper' ).find( 'a' ).each( function()
{
    var matches = $( this ).text().match( parenthesizedDigitPttrn );
    if( matches[1] && ! isNaN( matches[1] ) )
    {
        total += parseInt( matches[1], 10 );
    }
} );

alert( total );