haolan Posted August 19, 2007 Share Posted August 19, 2007 Hi.. Is there any way to change the font family in a textarea with a <select> box? It has to change immediately while selecting a new font in the select box.. :-Haolan Link to comment https://forums.phpfreaks.com/topic/65671-change-fontfamily-in-a-textarea/ Share on other sites More sharing options...
php_tom Posted August 19, 2007 Share Posted August 19, 2007 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. Link to comment https://forums.phpfreaks.com/topic/65671-change-fontfamily-in-a-textarea/#findComment-328081 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.