Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7545669
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T08:59:22+00:00 2026-05-30T08:59:22+00:00

i try to make text strikethrough with javascript. I know nothing about Javascript and

  • 0

i try to make text strikethrough with javascript.
I know nothing about Javascript and try to search on the net how to that.

 <script language="JavaScript">
            function recal(val,sum)
            { 
                if(sum == true)
                {
                    var total = parseInt(document.getElementById("total").innerHTML, 10);
                    total+=val;
                    document.getElementById("total").innerHTML=total;        
                }
                else
                {
                    var total = parseInt(document.getElementById("total").innerHTML, 10);
                    total-=val;
                    document.getElementById("total").innerHTML=total;   
                    var pnl = document.getElementById("totalEvents");
                }



                var pnl = document.getElementById("totalEvents");
                var pnl2 = document.getElementById("eventCategory");
                var pnl3 = document.getElementById("nameID");

                **strikethrough starts here**
                if (!sum && pnl.firstChild.tagName != "S" && pnl2.firstChild.tagname !="S")
                {
                    pnl.innerHTML = "<S>"+ pnl.innerHTML+"</S>";
                    pnl2.innerHTML = "<S>"+ pnl2.innerHTML+"</S>";
                }
                else 
                {
                    pnl.innerHTML = pnl.firstChild.innerHTML;
                    pnl2.innerHTML = pnl2.firstChild.innerHTML;
                }



            }
        </script>

it makes textstrikethrough but something is wrong. Even if i choose second checkbox it affects first checkbox why 🙁

http://jsfiddle.net/aHH9w/ (my full html page)

enter image description here

enter image description here

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T08:59:24+00:00Added an answer on May 30, 2026 at 8:59 am

    You are peforming a pretty convoluted way of achieving this, something that can actually be quite easily done. If you have an HTML element, say with the id ‘myelement’:

    <div id="myelement">Hello world</div>
    

    To create a strikethrough, all you need to do in JS is:

    var ele = document.getElementById("myelement");
    ele.style.setProperty("text-decoration", "line-through");
    

    If you need to check if there is a strikethrough on an element:

    var ele = document.getElementById("myelement");
    var isStruck = (ele.style.getProperty("text-decoration") == "line-through");
    

    Although this is not really recommended. Use an internal variable to keep track of state.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Whenever I use WCF, I always try to make immutable classes that end up
I try to make a view in ASP.NEt mvc 2 with a selectList. I
I try to make Folder for things in my ASP.Net Application (e.g. all with
I try to make my code fool-proof, but I've noticed that it takes a
I am wondering is it good practice to try to make a view that
I'm fighting with pointers :(. I try to make a function which do something
I'm try to make some changes to my ZenPhoto installation in order so that
Hi all I try to make my own tooltip script which follow my mouse
// for example $('#text').die('focusout'); //then I try to make it live() with a button
Did anyone try to make access to api.php?action=parse&text= page with the POST request? on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.