Form acceptCharset Property - Change the value of the accept-charset attribute in a form to UTF-8: - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Form

Description

Form acceptCharset Property - Change the value of the accept-charset attribute in a form to UTF-8:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<form id="myForm" accept-charset="ISO-8859-1">
  First name: <input type="text" name="fname" value="Donald"><br>
  Last name: <input type="text" name="lname" value="Duck"><br>
</form>/*from www .  j  a  v  a  2  s .  com*/

<button onclick="myFunction()">Test</button>

<p id="demo"></p>

<script>
function myFunction() {
    document.getElementById("myForm").acceptCharset = "UTF-8";
    document.getElementById("demo").innerHTML = "The character-set was changed from ISO-8859-1 to UTF8.";
}
</script>

</body>
</html>

Related Tutorials