• JSP
  • SQL Tutorial
  • JavaScript
  • Core Java
  • Spring
  • Java IO
  • Struts
  • jQuery
  • Servlet

  • <

    The id element defines a unique id for an HTML .This HTML id value can be used with CSS and JavaScript to perform certain task. In CSS, to select an element with a specific id, write hash (#) character followed by the id of the element.

    HTML Id Example



    <html>
    <head>
    <style>
    #paragraph {
        background-color: lightblue;
        color: black;
        text-align: center;
    } 
    </style>
    </head>
    <body>
    
    <p id="paragraph">welcome to javameant</p>
    
    </body>
    </html>
    


    HTML Id in Javascript



    <!DOCTYPE html>
    <html>
    <body>
    
    
    
    <h1 id="myid">welcome to javameant</h1>
    <button onclick="result()">Change text</button>
    
    <script>
    function result() {
        document.getElementById("myid").innerHTML = "see you soon";
    }
    </script>
    
    </body>
    </html>
    
    
    
    
    
















    © copyright 2017-2021 Completedone pvt ltd.