Basically I need to change the elements in a form based on a choice (radio button perhaps). So that 2 forms are potentially available on a page.
So far I've come up with this but it doesn't seem to work...
//javascript
function FormChange(toChange){
if (toChange){
var oldHTML = document.getElementById('li1').innerHTML;
var newHTML = "Company Name: " + "<input type="text" name="companyname" />";
document.getElementById('li1').innerHTML = newHTML;
}
//HTML
<form action="insert.php" method="post">
<li id="li1">Firstname: <input type="text" name="firstname" />
</form>
<input type = "button" value="Change that bad boy" onclick="FormChange(true)"/>
My Intention was to remove the firstname field and replace it with the companyname field.
Any help is greatly appreciated, thanks.