Just replace jquery
with querySelector
and set textContent
instead of text
var el = document.querySelector('span.slicethis');
el.textContent = el.textContent.slice(1, -1);
Demo
var el = document.querySelector('span.slicethis');
el.textContent = el.textContent.slice(1, -1);
<span class="slicethis">(10)</span>
Edit
$('span.slicethis')
iterate over all the items that match this selector, so if there are going to be multiple such elements, then you need to iterate them using querySelectorAll
[ ...document.querySelectorAll('span.slicethis') ].forEach( function(el){
el.textContent = el.textContent.slice(1, -1);
});
[ ...document.querySelectorAll('span.slicethis') ].forEach( function(el){
el.textContent = el.textContent.slice(1, -1);
});
<span class="slicethis">(1)</span>
<span class="slicethis">(10)</span>
<span class="slicethis">(100)</span>