Javascript DOM CSS Style textTransform Property set

Introduction

Transform all characters in a <p> element to uppercase:

document.getElementById("myP").style.textTransform = "uppercase";

View in separate window

<!DOCTYPE html>
<html>
<body>

<p id="myP">This is an example paragraph.</p>

<button type="button" onclick="myFunction()">Transform text</button>

<script>
function myFunction() {/*from www .j  av  a  2 s .c o  m*/
  document.getElementById("myP").style.textTransform = "uppercase";
}
</script>

</body>
</html>



PreviousNext

Related