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.
object.style.fontFamily = "font"
To change the font style by option dropdown: The font values can be passed in option tags using option value.
- Before selecting any option (Initial value – Times New Roman):
- After selecting an option in dropdown:
- After selecting another option in dropdown:
- How to change the font style of a text canvas using Fabric.js ?
- How to style a dropdown using CSS?
- How to change dropdown menu when time is changed ?
- CSS | font-style Property
- How to change the font-color of disabled input using CSS ?
- HTML | DOM Style font Property
- How to change the font size of a text canvas using Fabric.js ?
- How to change font-family of a text canvas using Fabric.js ?
- How to change the font of HTML5 Canvas using a button in Angular.js?
- How to change font size depending on width of container?
- How to change font-weight of a canvas-type text using Fabric.js ?
- How to Add Image into Dropdown List for each items ?
- How to remove the default arrow icon from a dropdown list?
- How to change the style of alert box using CSS ?
- How to change cursor style using jQuery ?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.