How to get font properties of particular element in JavaScript ? Last Updated : 13 Jun, 2023 Summarize Comments Improve Suggest changes Share Like Article Like Report Given a string element and the task is to get the font properties of a particular element using JavaScript. Approach: Store a string to the variable.Then use element.style.property to get the propertyValue of that element. Example 1: This example gets the font-family of the element [id = 'GFG']. html <!DOCTYPE html> <html lang="en"> <head> <title> How to get font properties of particular element in JavaScript ? </title> </head> <body style="text-align: center;"> <h1 style="color:green;"> GeeksforGeeks </h1> <h3 id="GFG" style="font-family: sans-serif;"> How to get font properties of particular element in JavaScript ? </h3> <button onclick="GFG_Fun()"> Click Here </button> <p id="GFG_Res"></p> <script> let elm1 = document.getElementById("GFG"); let elm2 = document.getElementById("GFG_Res"); function GFG_Fun() { elm2.innerHTML = "Font-style Property: '" + elm1.style.fontFamily + "'"; } </script> </body> </html> Output: Example 2: This example gets the font-weight of the element [id = 'GFG']. html <!DOCTYPE html> <html lang="en"> <head> <title> How to get font properties of particular element in JavaScript ? </title> </head> <body style="text-align: center;"> <h1 style="color:green;"> GeeksforGeeks </h1> <h3 id="GFG" style="font-weight: bold;"> How to get font properties of particular element in JavaScript ? </h3> <button onclick="GFG_Fun()"> Click Here </button> <p id="GFG_Res"></p> <script> let elm1 = document.getElementById("GFG"); let elm2 = document.getElementById("GFG_Res"); function GFG_Fun() { elm2.innerHTML = "Font-weight Property: '" + elm1.style.fontWeight + "'"; } </script> </body> </html> Output: Comment More infoAdvertise with us Next Article JavaScript Get the text of a span element P PranchalKatiyar Follow Improve Article Tags : JavaScript Web Technologies JavaScript-Questions Similar Reads How to Get Current Value of a CSS Property in JavaScript ? In this article, we will see how to get the current value of a CSS property using JavaScript. Below are the approaches used to Get Current Value of a CSS Property in JavaScript: Table of Content Inline StyleUsing the getComputedStyle() methodApproach 1: Inline StyleInline styles are styles that are 3 min read JavaScript Get the text of a span element We are given an HTML document and the task is to get the text of an <span> element. Below are the methods to get the text of a span element using JavaScript:Table of ContentHTML DOM textContent PropertyHTML DOM innerText PropertyHTML DOM textContent PropertyThis property set/return the text co 2 min read How to select DOM Elements in JavaScript ? Selecting DOM (Document Object Model) elements is a fundamental aspect of web development with JavaScript. It allows developers to interact with and manipulate elements on a webpage dynamically. Proper selection of elements is crucial for tasks such as updating content, adding event listeners, or mo 3 min read How to get font size of an element using jQuery ? In this article, we will see how to get the font size of an element using jQuery. To get the font size of an element, we will use css() method. The css() method is used to set or return the style property of the selected element. Syntax: var style = $(selector).css(property) Return value: This metho 2 min read How to change font style using drop-down list in JavaScript ? To change or set a font style for certain text, the fontFamily CSS property needs to be changed. The fontFamily property sets or returns a list of font-family names for text in an element. Syntax: object.style.fontFamily = "font" To change the font style by option dropdown: The font values can be pa 2 min read How to Change Font Size using drop-down List in JavaScript ? To change or set a font size for certain text, the fontSize property needs to be changed. The fontSize property sets or returns a list of fontSize names for text in an element.CSS font-size property is used to specify the font's height and size. It affects the size of an element's text. It has a med 2 min read Like