Saturday, May 11, 2024
 Popular · Latest · Hot · Upcoming
33
rated 0 times [  37] [ 4]  / answers: 1 / hits: 17971  / 11 Years ago, sat, august 17, 2013, 12:00:00

I want to strike through text in Javascript but I can't seem to get the code to work.



var message = document.getElementById('helloWorld');
setTextContent(message, 'hello world!'.strike());


Would appreciate any help. Would also like to do it without using css.



Should Also mention that these lines of code are inside another function called totalPackage() which runs when the user clicks a button. I want my message hello world! to be displayed when this other function is called.


More From » string

 Answers
6

try this



var message = document.getElementById('helloWorld');
message.innerHTML='<del>helloworld</del>'

[#76306] Thursday, August 15, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
stefanicarolinat

Total Points: 145
Total Questions: 91
Total Answers: 93

Location: Cambodia
Member since Thu, Oct 7, 2021
3 Years ago
stefanicarolinat questions
Mon, Nov 15, 21, 00:00, 3 Years ago
Fri, Apr 16, 21, 00:00, 3 Years ago
Thu, Oct 15, 20, 00:00, 4 Years ago
Fri, Jul 17, 20, 00:00, 4 Years ago
;