1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
| // JavaScript Document
var current = 1;
function initMainControls() {
$("#1_articles").autocomplete({
source: "utils/autocomplete-articles2.php",
minLength: 0,
select: function(event, ui) {
$('#retour_id_1').val(ui.item.id);
$("#retour_cond_1").html(ui.item.cond).addClass('larger_bold');
}
});
}
function initTemplateControls() {
$("#_articles").autocomplete({
source: "utils/autocomplete-articles2.php",
minLength: 0,
select: function(event, ui) {
$('#retour_id_').val(ui.item.id);
$("#retour_cond_").html(ui.item.cond).addClass('larger_bold');
}
});
}
function reindexControls() {
// $("#_fund").attr("id", current + "_fund")
$("#_articles").attr("id","current" + _articles),
$("#retour_id_").attr("id","retour_id_" + current),
$("#retour_cond_").attr("id","retour_cond_" + current);
}
var addTransaction = function () {
current++;
$addTransaction = $("#ajout-ligne").clone(true, true);
$addTransaction.attr("id", current)
$addTransaction.removeClass("hide_element");
$addTransaction.appendTo("#new_line");
$addTransaction.find('input,textarea').val('');
reindexControls();
}
$(document).ready(function () {
initMainControls();
initTemplateControls();
$("#clone").live("click", addTransaction);
}); |
Partager