Witajcie!
Mam problem, otoz mam kod, ktory tworzy mi pola w formularzu.
Kod:
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<style type="text/css">
label { display: block;}label a{
color: #CC0000;
text-decoration: none; margin-left: 5px;
}
label a:hover{
text-decoration: underline;
}
</style>
<script>
$(document).ready(
function()
{
$("#dodaj").click(function()
{
var new_label = $("<label>");
var new_input = $("<input>");
new_input.attr("type", "text");
var new_link = $("<a>");
new_link.attr("href", "#");
new_link.html("usuń");
new_link.click(function()
{
$(this).parent("label").remove();
return false;
});
new_label.append(new_input);
new_label.append(new_link);
$("form[name=formularz]").append(new_label);
return false;
});
});
</script>
</head>
<body>
<a href="#" id="dodaj">Dodaj</a>
<form name="formularz" action="">
</form>
</body>
Chce aby bylo wiecej przyciskow Dodaj - np dodaj+tekst, dodaj+tekst2 i zeby ten tekst byl wyswietlany jako value w dodanym polu input. Probowalem dodac value, ale nie moglem tego przekazac z linku do pola.