The easiest way to use vanilla javascript is to simply manipulate the contents of the HTML. It might look like this:
var targetElem = document.getElementById('myid');
targetElem.innerHTML = '<strike>' + targetElem.innerHTML + '</strike>';
Using jQuery, this task becomes a little more trivial using .contents()+ .wrapAll():
$('#myid').contents().wrapAll('<strike/>');
Another alternative using css might also be an idea:
targetElem.style.textDecoration = 'line-through';
Or again using jQuery for more cross-browser matching:
$('#myid').css('text-decoration', 'line-through');
source
share