Transform all characters in a <p> element to uppercase: - Javascript CSS Style Property

Javascript examples for CSS Style Property:textTransform

Description

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

Demo Code

ResultView the demo 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() {/*  w w w .  j  a  v a2  s . c o  m*/
    document.getElementById("myP").style.textTransform = "uppercase";
}
</script>

</body>
</html>

Related Tutorials