Jump to content
Sign in to follow this  
RawrRawrRob

How To Change Font Family & Font Size Using JavaScript?

Recommended Posts

Hello, I'm new to JavaScript and I'm trying to use JavaScript for my website. I want to have a sample sentence, where you can select the font family it is in and then you can also click on a size option to change the display size for the font. I've tried to get this to work for a while but just can seem to do it! If anyone can help it will be greatly appreciated!

Share this post


Link to post
Share on other sites

Everything you need to know about changing the style is here. Check the syntax example at the top, then scroll down to see the text properties.

Edited by Deirdre's Dad

Share this post


Link to post
Share on other sites
Hello, I'm new to JavaScript and I'm trying to use JavaScript for my website. I want to have a sample sentence, where you can select the font family it is in and then you can also click on a size option to change the display size for the font. I've tried to get this to work for a while but just can seem to do it! If anyone can help it will be greatly appreciated!
document.getElementById("id").style.property="value"in the place of property replace with "font-family or font-size"by using jquery your requirement can be possible more easily.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...