HTML DOM inputEncoding Property

HTMLWeb DevelopmentFront End Technology

The HTML DOM inputEncoding property returns the character encoding for the parsable HTML document and is overwritable.

Syntax

Following is the syntax −

Returning character encoding of html document.

document.inputEncoding

Example

Let us see an example for InputEncoding property −

 Live Demo

<!DOCTYPE html>
<html>
<head>
<title>InputEncoding</title>
<style>
   form {
      width:70%;
      margin: 0 auto;
      text-align: center;
   }
   * {
      padding: 2px;
      margin:5px;
   }
   input[type="button"] {
      border-radius: 10px;
   }
</style>
</head>
<body>
<form>
<fieldset>
<legend>inputEncoding</legend>
<input type="button" onclick="getEncoding()" value="Is my code secure?">
<div id="divDisplay"></div>
</fieldset>
</form>
<script>
   var divDisplay = document.getElementById("divDisplay");
   function getEncoding() {
      divDisplay.textContent = 'Yes, your code is secure. Encoding: '+document.inputEncoding;
   }
</script>
</body>
</html>

Output

This will produce the following output −

Before clicking ‘Is my code secure?’ button −

After clicking ‘Is my code secure?’ button −

raja
Updated on 30-Jul-2019 22:30:26

Advertisements