HTML DOM S Object


The HTML DOM S Object represent the <s> element of an HTML document.

Let us create an s object −

Syntax

Following is the syntax −

document.createElement(“S”);

Example

Let us see an example of s object −

 Live Demo

<!DOCTYPE html>
<html>
<head>
<style>
   body{
      text-align:center;
      background-color:#fff;
      color:#0197F6;
   }
   h1{
      color:#23CE6B;
   }
   .drop-down{
      width:35%;
      border:2px solid #fff;
      font-weight:bold;
      padding:8px;
   }
   .btn{
      background-color:#fff;
      border:1.5px dashed #0197F6;
      height:2rem;
      border-radius:2px;
      width:60%;
      margin:2rem auto;
      display:block;
      color:#0197F6;
      outline:none;
      cursor:pointer;
   }
   p{
      font-size:1.2rem;
      background-color:#db133a;
      color:#fff;
      padding:8px;
   }
</style>
</head>
<body>
<h1>DOM S Object Demo</h1>
<button onclick="createS()" class="btn">Create a s object</button>
<script>
   function createS() {
      var sElement = document.createElement("S");
      sElement.innerHTML="Hi! I'm <s> element in HTML";
      document.body.appendChild(sElement);
   }
</script>
</body>
</html>

Output

This will produce the following output −

Click on “Create a s object” button to create a s object −

Updated on: 30-Jul-2019

55 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements