JavaScript HTML Methods

The JavaScript HTML Methods will help you to add HTML tags around the string object. The following table will show you the list of available HTML wrapper Functions in JavaScript Programming Language.

JavaScript HTML MethodsDescription
anchor()Creates an HTML anchor with Name attribute around the Text
big()Creates an HTML <big> tag around the Text. It means this JavaScript HTML Method will display the given text in big font
blink()Creates an HTML <blink> tag around the Text. It displays the given text in blinking
bold()Creates an HTML <b> tag around the Text. It will display the given text in bold
fixed()Creates an HTML <TT> tag around the Text. It will help you to display the given text in fixed font
fontcolor()This HTML Method creates an HTML <font> tag with color attribute around the Text. It means, it will display the given text in specified color
fontsize()Creates an HTML <font> tag with Size attribute around the Text. It means, it will display the given text in specified font
italics()Creates an HTML <l> tag around the Text. This HTML Method displays the given text in Italic font
link()Creates an HTML anchor with href attribute around the Text
small()Creates an HTML <small> tag around the Text. It means it will display the given text in small font
strike()Creates an HTML <strike> tag around the Text. It means it will display the given text with strike through
sub()Creates an HTML <sub> tag around the Text. Means it will show the given text as subscript
sup()Creates an HTML <sup> tag around the Text. Means, it will display the given text in as superscript format

NOTE: Some of the JavaScript HTML Methods may not work in your favorite browsers. So, Please be careful while using these JavaScript non-standard functionalities.

JavaScript HTML Methods Example

This example will help you understand the functionality of each and every HTML Wrapper method present in JavaScript Programming Language.

<!DOCTYPE html>
<html>
<head>
    <title>JavaScript HTML Wrapper Methods</title>
</head>
<body>
<h1> JavaScript HTML Methods </h1>
<script>
    var txt = "Tutorial Gateway";
    
    document.write("The Original String: " + txt);
    document.write("<p>BIG: " + txt.big() + "</p>");
    document.write("<p>SMALL: " + txt.small() + "</p>");

    document.write("<p>BOLD: " + txt.bold() + "</p>");
    document.write("<p>ITALIC: " + txt.italics() + "</p>");

    document.write("<p>FIXED: " + txt.fixed() + "</p>");
    document.write("<p>STRIKE: " + txt.strike() + "</p>");
    
    document.write("<p>Font Color: " + txt.fontcolor("Red") + "</p>");
    document.write("<p>Font Size: " + txt.fontsize(6) + "</p>");
    
    document.write("<p>Subscript: " + txt.sub() + "</p>");
    document.write("<p>Superscript: " + txt.sup() + "</p>");
    
    document.write("<p>Link: " + txt.link("https://www.tutorialgateway.org") + "</p>");
    document.write("<p>Blink: " + txt.blink() + "</p>");
</script>
</body>
</html>
JavaScript HTML Methods