Follow along with the video below to see how to install our site as a web app on your home screen.
Бележка: This feature may not be available in some browsers.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Добавяне на input поле към форма</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251" />
<script type="text/javascript" src="jquery-1.3.2.min.js">
</script>
<script type="text/javascript">
$(function() {
var i = $('input').size() + 1;
$('#add').click(function() {
$('<input type="file" name="fileatt' + i + '" />').appendTo('form');
i++;
});
$('#remove').click(function() {
$('input:last').remove();
i--;
});
});
</script>
</head>
<body>
<p>
<a href="#" id="add">Добави</a> | <a href="#" id="remove">Изтрии</a>
<form>
<input type="file" name="fileatt" />
</form>
</p>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Добавяне на input поле към форма</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251" />
<script type="text/javascript" src="jquery-1.3.2.min.js">
</script>
<script type="text/javascript">
$(function() {
var i = $('input').size() + 1;
$('#add').click(function() {
$('<input type="file" name="fileatt' + i + '" />').appendTo('form');
i++;
});
$('#remove').click(function() {
if (i<3) {
} else {
$('input:last').remove();
i--;
}
});
});
</script>
</head>
<body>
<p>
<a href="#" id="add">Добави</a> | <a href="#" id="remove">Изтрии</a>
<form>
<input type="file" name="fileatt" />
</form>
</p>
</body>
</html>
adrian каза:Хубаво е да си зададеш някакъв клас за тези инпут полета и в кода да сложиш и класа, защото ако имаш още input полета ще изкарва различен брой.
$('<input type="file" class="attached" name="fileatt' + i + '" />').appendTo('form');
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Добавяне на input поле към форма</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251" />
<script type="text/javascript" src="jquery-1.3.2.min.js">
</script>
<script type="text/javascript">
$(function() {
var i = $('input.attached').size() + 1;
$('#add').click(function() {
$('<input type="file" name="fileatt"' + i + '" class="attached" />').appendTo('form');
i++;
});
$('#remove').click(function() {
if (i<3) {
} else {
$('input.attached:last').remove();
i--;
}
});
});
</script>
</head>
<body>
<p>
<a href="#" id="add">Добави</a> | <a href="#" id="remove">Изтрии</a>
<form>
<input type="file" name="fileatt" class="attached" />
</form>
</p>
</body>
</html>