Sunday, May 19, 2024
 Popular · Latest · Hot · Upcoming
110
rated 0 times [  117] [ 7]  / answers: 1 / hits: 18216  / 11 Years ago, mon, april 8, 2013, 12:00:00

Strike out a word in javascript/jquery when item clicked.



So I am clicking and item ,the item fades out but in the same time I want the text to strike out.



Ex. I have an apple(image) and a apple(text). When I click on the apple I want the image to fade out and the text to strike out.



<div id=items>
<p>Apple</p>
</div>
<div id=content>
<div class=box id=pic1> <img src = /images/apple.png /></div>
<script>
$(#pic1).click(function () {
$(#pic1).fadeOut(slow);
});
</script>


This is my code until the image fades out but I cannot figure out how can I make the text to strike out???


More From » jquery

 Answers
8

jsFiddle Demo



You could wrap the text in <del>



$(#pic1).click(function () {
$(#items p).wrap(<del>);
$(#pic1).fadeOut(slow);
});

[#79031] Monday, April 8, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
anayaashleyh

Total Points: 597
Total Questions: 96
Total Answers: 86

Location: Papua New Guinea
Member since Thu, Jul 9, 2020
4 Years ago
;