treehouse : what would you like to learn today?
Web Design Web Development iOS Development

remove a Class

  • hi,

    hi , i want to remove this tools which i show in below picture with java script From my ning website, i used

    document.getElementById('xj_message_container').document.getElementByclass('texteditor_toolbar').style.display='none';

    removeClass(document.getElementById("xj_message_container"), "texteditor_toolbar")


    but it still doesnt work , any idea ?
    tnx
    <p style="text-align: left;"><img src="http://api.ning.com/files/o3VTA62SVkDDuDa4yN9tBxCIvofztaY2E60Vgwk8zgFwnywc-EAhdEpZE0ZAA41rN778UzK5ng1Yp*Vthjcv5syb7MIB*wXo/toolsremove.jpg&quot; alt=""/></p>
  • Using raw javascript I came up with this.
    <!DOCTYPE html>
    <html lang=\"en\">
    <head>
    <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />
    <title>Javscript, remove class</title>

    <!-- ==================== -->
    <!-- = CSS and JS Files = -->
    <!-- ==================== -->
    <style type=\"text/css\" media=\"screen\">
    div {
    border: 1px solid #000;
    }
    .padding {
    padding: 10px;
    }
    .background {
    background: #f7f7f7;
    }
    </style>

    <script type=\"text/javascript\" charset=\"utf-8\">

    window.onload = function() {

    var div = document.getElementById('my-div'),
    div_classes = div.className

    div_classes = div_classes.replace(/( )?background( )?/, '');

    div.className = div_classes;

    }

    </script>
    </head>

    <body>

    <div id=\"my-div\" class=\"padding background\">
    Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
    </div>

    </body>
    </html>