Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Aug 2013
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    javascript problem clearing nodes

    hell , i have this code:

    function DetailsRemove()
    {
    document.getElementById("replace01").innerHTML="'."".'";
    document.getElementById("replace02").innerHTML="'."".'";
    document.getElementById("replace03").innerHTML="'."".'";
    return false;
    }

    but it doesnt work, previous function (which adds work), but clearing content of node wont work, its there possible to clear text in in dom node?

  • #2
    Regular Coder
    Join Date
    Aug 2010
    Posts
    945
    Thanks
    19
    Thanked 205 Times in 203 Posts
    "'."".'"

    Code:
     
    <!DOCTYPE html>
    <html>
    <head>
    <script>
    function DetailsRemove()
    {
    document.getElementById("replace01").innerHTML="";
    document.getElementById("replace02").innerHTML="";
    document.getElementById("replace03").innerHTML="";
    return false;
    }
    </script>
    </head>
    <body>
    <div id="replace01">
    hello
    </div>
    <div id="replace02">
    hiyas
    </div>
    <div id="replace03">
    whasUp
    </div>
     
    <button type="button" onClick="DetailsRemove()">preesMe</button>
    </body>
    </html>

  • #3
    Senior Coder xelawho's Avatar
    Join Date
    Nov 2010
    Posts
    2,773
    Thanks
    55
    Thanked 518 Times in 515 Posts
    if you want those quote marks in there you will have to escape them...
    Code:
    document.getElementById("replace01").innerHTML="'.\"\".'";
    //etc

  • #4
    New to the CF scene
    Join Date
    Aug 2013
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ok, i tried but it dont work,
    document.getElementById("replace02").innerHTML="'."<button onclick='DetailsRemove();'><img src='data/images/default/English/Buttons/DetailsRemove.png' class='Modules' id='DetailsRemove'></button>".'";
    works, but with replace02, when filled after previous function, cleaning with same technique dont work. (keep unchanged)

  • #5
    Senior Coder xelawho's Avatar
    Join Date
    Nov 2010
    Posts
    2,773
    Thanks
    55
    Thanked 518 Times in 515 Posts
    um... yeah, I've read that a few times and I have no idea what you are trying to say and even less idea of what you are trying to do than I did before. Try posting more code.


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •