I've written the following HTML page to serve as a simple text editor.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Web Text Editor</title>
</head>
<body>
<form name="editor_zone" action="" method="POST">
<textarea cols="50" rows="10" name="text_space">
Enter your text here.
</textarea> <br>
<input type="radio" name="add_node">Add Node
<input type="radio" name="delete_node">Delete Node
<input type="radio" name="insert_after"> Insert after node
<input type="radio" name="replace"> Replace node
<br>
<div> Paragraph #:
<select>
<option value="1">1</option>
</select>
<input type="submit" onclick="">
</div>
</form>
<div id="mod_area">
</div>
</body>
</html>
I'm trying to make it so that the "add node" button populates the "mod_area" div with the text in the text area. I thought setting the "onclick" method of the radio button to the Javascript would suffice, a la:
<input type="radio" name="add_node" onclick="addNode("mod_area")">Add Node
--etc.
function addNode(id) {
var txt_src = document.getElementById( id );
var txt = "<p>";
txt += txt_src.value;
txt += "</p>";
e.innerHTML = e.innerHTML + txt;
}
but so far clicking the button does nothing. Since my text area is in a form, should I instead be checking the status of the radio button/calling the function from the submit's onclick?