String italics() Method - Javascript String

Javascript examples for String:italics

Description

The italics() method displays a string in italic.

This method returns the string embedded in the <i> tag, like this:<i>string</i>

Parameters

None.

Return Value:

A string embedded in the <i> tag

The following code shows how to Display the text in italic:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

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

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

<script>
function myFunction() {//from ww  w.  j a v a2s.c  o m
    var str = "Hello World!";
    var result = str.italics();
    document.getElementById("demo").innerHTML = result;
}
</script>

</body>
</html>

Related Tutorials