Javascript examples for CSS Style Property:fontWeight
Return the font weight of a <p> element:
<!DOCTYPE html> <html> <body> <p id="myP" style="font-weight:bold">This is a paragraph.</p> <button type="button" onclick="myFunction()">Return font weight</button> <script> function myFunction() {/* w w w .j a v a 2 s. com*/ console.log(document.getElementById("myP").style.fontWeight); } </script> </body> </html>