I have this code here and I cannot figure out what Im doing wrong.
I cannot make "remove" link working and more importantly when I send it with "post" to another page to process with php, I cannot capture data into variable from consecutive forms Im creating.
<html>
<head>
<style media="screen" type="text/css">
* { font-family:Arial; }
h2 { padding:0 0 5px 5px; }
h2 a { color: #224f99; }
a { color:#999; text-decoration: none; }
a:hover { color:#802727; }
p { padding:0 0 5px 0; }
input { padding:5px; border:1px solid #999; border-radius:4px; -moz-border-radius:4px; -web-kit-border-radius:4px; -khtml-border-radius:4px; }
</style>
<title>test</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js" type="text/javascript">
</script>
</head>
<body>
<script>
$(function() {
var scntDiv = $('#p_scents');
var i = $('#p_scents p').size() + 1;
$('#addScnt').live('click', function() {
$('<label for="ticketCantidad"><input type="text" id="ticketCantidad" size="20" name="ticketCantidad' + i + '" value="" placeholder="Valor de Tickets" /></label> <a href="#" id="remScnt">Remove</a>').appendTo(scntDiv);
i++;
$('<label for="ticketValue"><input type="text" id="ticketValue" size="20" name="ticketValue' + i + '" value="" placeholder="Cantidad de Tickets" /></label> <a href="#" id="remScnt">Remove</a><p></p>').appendTo(scntDiv);
i++;
return false;
});
$('#remScnt').live('click', function() {
if (i > 2) {
$(this).parents('p').remove();
i--;
}
return false;
});
});
</script>
<form action="testProces.php" method="POST" name="testForm">
<h1>Ticket Restaurante</h1>
<h2><a href="#" id="addScnt">Otro formulario</a></h2>
<div id="p_scents">
<p>
</p>
</div>
<h1>Cheque Gourmet</h1>
<input name="submit" type="submit">
</form>
</body>
</html>