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>v otes)</spa n>
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</spa n>
Thanks in advance,
Winter
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
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</spa
Thanks in advance,
Winter
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
$('span.total-votes').text(function(_, text) {
return text.replace(/\(|votes?\)/g, '');
});
ASKER
Thank you very much expert.
Winter
Winter
ASKER
would that be:
$('span.total-votes').text
return text.replace(/\(|votes\)/g
return text.replace(/\(|vote\)/g,
});