Go to GoReading for breaking news, videos, and the latest top stories in world news, business, politics, health and pop culture.

How to Remove an Attribute With JavaScript

104 3
    • 1). Right-click the HTML file you want to edit and select "Open With." Double-click the HTML editor you want to use to set up the JavaScript.

    • 2). Type the following code in the body of the HTML file:

      <script type="text/javascript"> </script>

      These two tags tell the browser to run JavaScript code when the page loads.

    • 3). Type the following code within the JavaScript tags to edit and clear an attribute:

      document.getElementById("elementname").style.border = "";

      Replace "elementname" with the HTML element you want to edit. In this example, the element's border is cleared. You can use any of the attribute styles included with HTML elements.

Source...

Leave A Reply

Your email address will not be published.