Jump to content

Change fontFamily in a textarea


haolan

Recommended Posts

Try this:

<html>
<head>
<script type='text/javascript'>
function changeFont() { document.getElementById('txt').style.fontFamily="Sans"; }
</script>
</head>
<body>
<textarea onclick='changeFont()' id='txt'>Here is some text whose font will be changed if you click here.</textarea>
</body>
</html>

 

It shouldn't be too hard to modify it to work with a select dropdown.

Hope that helps.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.