Javascript examples for CSS Style Property:fontFamily
Get the font of a <p> element:
<!DOCTYPE html> <html> <body> <p id="myP" style="font-family:Arial,Helvetica,sans-serif;">This is a paragraph, shown in the Arial font.</p> <button type="button" onclick="myFunction()">Return font</button> <script> function myFunction() {/*from www . jav a 2s. c om*/ console.log(document.getElementById("myP").style.fontFamily); } </script> </body> </html>