Link to home
Start Free TrialLog in
Avatar of glepiza
glepiza

asked on

remove text using query

Dear experts,

I am using fivestar module to rate different kind of content from my website. The problem is that I don´t know how to remove  the parenthesis that surrounds a text as the following:

<span class="total-votes">(<span>4</span>votes)</span>

Is there a way to leave only the number and  remove the parenthesis and the word votes? something like this:

<span class="total-votes">4</span>

Thanks in advance,

Winter
ASKER CERTIFIED SOLUTION
Avatar of Scott Fell
Scott Fell
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of glepiza
glepiza

ASKER

<span class="total-votes">(<span>1</span>vote)</span>

would that be:

      $('span.total-votes').text(function(_, text) {
          return text.replace(/\(|votes\)/g, '');
          return text.replace(/\(|vote\)/g, '');
      
      });
$('span.total-votes').text(function(_, text) {
    return text.replace(/\(|votes?\)/g, '');
});

Open in new window

Avatar of glepiza

ASKER

Thank you very much expert.

Winter