Jump to content

Drop down menu and typing in website


Mich1982

Recommended Posts

Hi, I need help. Attached is a screenshot of something I would like to try to add in my website.

basically there is a drop down menu to choose font and there is a row to type the name you want to see how it looked like in the chosen font type.

how to code it? I’m a beginner just learning.

 

27D81B67-BD5E-4719-B8FD-271F17D1E23D.jpeg

Link to comment
Share on other sites

This'll be the main part of your script

https://www.w3schools.com/jsref/prop_style_fontfamily.asp

You might be able to use a variation of the example shown.

var listValue = selectTag.options[selectTag.selectedIndex].text;
document.getElementById("myP").style.fontFamily = listValue;

You'd probably need to run this code when the value changes so this may also be of use to you.

https://www.w3schools.com/jsref/event_onchange.asp

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...