I want to create a form with a +
button, which creates more fields so that the user can send as many forms as he wants.
I tried this code, but without success:
var coluna = 1;
function plus() {
document.write('<button onclick="plus()">+</button><br><hr><br>');
document.write("<form action='teste.php' name='form'>");
coluna = coluna + 1;
botao = coluna - 1;
espacos = '<br><input type="text" name="assunto'+coluna+'"><br><br><textarea name="texto'+coluna+'" rows="3" cols="20"></textarea><br><br><button onclick="plus()">+</button><br><hr><br>';
document.write("teste");
document.write(coluna);
document.write(espacos);
document.write('<button onclick="document.form.submit()" id="submit'+coluna+'" name="rows" value="'+coluna+'">Enviar</button><br>');
//document.write('<input type="submit" id="submit'+coluna+'" name="submit'+coluna+'" value="enviar">');
document.getElementById('submit'+botao+'').style.visibility = "hidden";
document.write("</form>");
}