2012-11-15 09:23:39 +00:00
|
|
|
// var $CloneTarget ;
|
|
|
|
|
2012-11-12 02:41:41 +00:00
|
|
|
function checkMultipleInput() {
|
|
|
|
$(".multipleInput").each(function() {
|
|
|
|
$(this).children('.controls').length==1 ? $(this).addClass("plural") : $(this).removeClass("plural")
|
|
|
|
});
|
|
|
|
}
|
|
|
|
function removeInput(){
|
|
|
|
$(".removeInput").click(function (){
|
|
|
|
$(this).parents(".controls").remove();
|
|
|
|
checkMultipleInput();
|
|
|
|
return false;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
$(document).ready(function(){
|
|
|
|
var $modalNumber = 0;
|
|
|
|
checkMultipleInput();
|
|
|
|
removeInput();
|
|
|
|
$(".addinput").click(function (){
|
|
|
|
$modalNumber+=1;
|
|
|
|
var $CloneTarget = $(this).parents(".controls").prev(".multipleInput").children('.controls:last');
|
|
|
|
$(this).parents(".controls").prev(".multipleInput").append($CloneTarget.clone());
|
2012-11-16 07:36:08 +00:00
|
|
|
class_to_be_removed = $(this).parents(".controls").prev(".multipleInput").attr("ext_class")
|
2012-11-15 09:23:39 +00:00
|
|
|
// $(this).parents(".controls").prev(".multipleInput").children('.controls:last input').val("");
|
|
|
|
$(this).parents(".controls").prev(".multipleInput").children('.controls:last').find('input').val('')
|
2012-11-16 07:36:08 +00:00
|
|
|
|
|
|
|
$(this).parents(".controls").prev(".multipleInput").children('.controls:last').find('.tab-pane').removeClass(class_to_be_removed).addClass("NewInput_"+$modalNumber)
|
2012-11-15 09:23:39 +00:00
|
|
|
btn = $(this).parents(".controls").prev(".multipleInput").children('.controls:last').find(".nav.nav-pills li")
|
|
|
|
$.each(btn,function(i,value){
|
|
|
|
old_link = $(this).children("a").attr("href");
|
2012-11-16 07:36:08 +00:00
|
|
|
$(this).children("a").attr("href",".NewInput_"+$modalNumber);
|
2012-11-15 09:23:39 +00:00
|
|
|
});
|
2012-11-12 02:41:41 +00:00
|
|
|
removeInput();
|
|
|
|
checkMultipleInput();
|
|
|
|
return false;
|
|
|
|
})
|
|
|
|
});
|