How to change font-weight of a text using JavaScript ? Last Updated : 25 Dec, 2020 Comments Improve Suggest changes Like Article Like Report In this article, we will set the font-weight of a text dynamically using JavaScript. Ti change the font weight dynamically, we use HTML DOM Style fontWeight property. Syntax: object.style.fontWeight = "value" Property Values: normal: The font weight is the default value.lighter: The font weight is the lighter than normal.bold: The font weight is bolder than normal.bolder: The font weight is bolder than bold.value: It defines from 100 to 900 where 400 is normal value.initial: It sets to its default font weight.inherit: It inherits this property from its parent element. Example: HTML <!DOCTYPE html> <html> <head> <title> How to change font-weight of a text using JavaScript? </title> </head> <body style="text-align: center;"> <h1 style="color: green"> GeeksforGeeks </h1> <h2> How to change font-weight of <br>a text using JavaScript? </h2> <p id="sudo">Welcome to GeeksforGeeks</p> <br> <button type="button" onclick="myGeeks()"> Click to change </button> <script> function myGeeks() { document.getElementById("sudo") .style.fontWeight = "bold"; } </script> </body> </html> Output: Before Click the Button: After Click the Button: Supported Browsers: Google ChromeInternet ExplorerMozilla FirefoxOperaSafari Create Quiz Comment V vkash8574 Follow 0 Improve V vkash8574 Follow 0 Improve Article Tags : JavaScript Web Technologies JavaScript-Questions Explore JavaScript BasicsIntroduction to JavaScript4 min readVariables and Datatypes in JavaScript6 min readJavaScript Operators5 min readControl Statements in JavaScript4 min readArray & StringJavaScript Arrays7 min readJavaScript Array Methods7 min readJavaScript Strings5 min readJavaScript String Methods9 min readFunction & ObjectFunctions in JavaScript5 min readJavaScript Function Expression3 min readFunction Overloading in JavaScript4 min readObjects in JavaScript4 min readJavaScript Object Constructors4 min readOOPObject Oriented Programming in JavaScript3 min readClasses and Objects in JavaScript4 min readWhat Are Access Modifiers In JavaScript ?5 min readJavaScript Constructor Method7 min readAsynchronous JavaScriptAsynchronous JavaScript2 min readJavaScript Callbacks4 min readJavaScript Promise4 min readEvent Loop in JavaScript4 min readAsync and Await in JavaScript2 min readException HandlingJavascript Error and Exceptional Handling6 min readJavaScript Errors Throw and Try to Catch2 min readHow to create custom errors in JavaScript ?2 min readJavaScript TypeError - Invalid Array.prototype.sort argument1 min readDOMHTML DOM (Document Object Model)8 min readHow to select DOM Elements in JavaScript ?3 min readJavaScript Custom Events4 min readJavaScript addEventListener() with Examples9 min readAdvanced TopicsClosure in JavaScript4 min readJavaScript Hoisting6 min readScope of Variables in JavaScript3 min readJavaScript Higher Order Functions7 min readDebugging in JavaScript4 min read Like