Views: 2
How to create a bold text using javascript.
<! Doctype html>
<html lang="en">
<head>
<title> make a text bold using javascript</title>
</head>
<body>
<p id="mytext"> this is some text </p >
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Make Text Bold with JavaScript</title>
</head>
<body>
<p id="myText">This is some text.</p>
<button onclick="makeTextBold()">Make Text Bold</button>
<script>
function makeTextBold() {
var element = document.getElementById("myText");
element.innerHTML = "<b>" + element.innerHTML + "</b>";
}
</script>
</body>
</html>