"pruebas"
Bootstrap 3.2.0 Snippet by XhamirM

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
<link href="//netdna.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//netdna.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
<!------ Include the above in your HEAD tag ---------->
<div class="form-group" id="pago-div">
<label for="amount" class="col-sm-3 control-label">Pago</label>
<div class="col-sm-3">
<input type="number" class="form-control" id="amount" name="amount">
</div>
<div class="col-sm-4">
<select id="f_pago" name="f_pago" class="form-control" required="">
<option>Efectivo</option>
<option>Tarjeta</option>
<option>Deposito</option>
<option>Cheque</option>
<option>Transferencia</option>
</select>
</div>
<div class="col-sm-2">
<button type="button" class="btn btn-default pay-add-button" id="click-me">
<span class="glyphicon glyphicon-plus"></span></button>
</div>
</div>
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
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
Array.prototype.remove = function(x) {
var i;
for(i in this){
if(this[i].toString() == x.toString()){
this.splice(i,1)
}
}
}
var array = [];
var pivot = "";
$(document).on('change', '#f_pago', function(){
array.pop();
$("option:selected",this).each(function(){
array.push($(this).text().trim());
});
console.log(array);
});
$(document).on('click', '#remove-me', function(){
var superparent = $(this).parent().parent();
var option = $(superparent).find("#f_pago > option:selected");
array.remove($(option).text().trim());
console.log(array);
$(superparent).remove();
});
//$(document).on('click',"#click-me",function(){
// $("#f_pago").prop("disabled",true);
// $("body").find("#f_pago option:selected").each(function(){
// if($(this).text().trim() === pivot){
// $(this).parent().prop("disabled",false);
// }
//});
//});
$(document).ready(function(){
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Related: See More


Questions / Comments: