I want to change the font when I highlight a text in the textarea. The function below changes the whole font in the textarea, rather than the text I want to change.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>E-commerce Website</title>
<script>
function selectFont() {
document.getElementById("note_header").style.fontFamily = "cursive";
}
</script>
</head>
<body>
<select id="select_font" onchange="selectFont()">
<option>Select a font</option>
<option>Cursive</option>
</select>
<textarea id="note_header">Title</textarea>
</body>
</html>