-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.html
43 lines (32 loc) · 1021 Bytes
/
test.html
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
<!DOCTYPE html>
<html>
<head>
<script src="lib/jquery.js"></script>
<script>
var myFruits = ['orange','banana','apple'];
var mis_campos = $("<select>");
myFruits.forEach(function(elem,index) {
mis_campos.append($("<option>").attr("id",index).text(elem));
});
var botones = $("<a>").append($("<button>").text("+").attr('onclick', 'f_add()'));
botones.append($("<button>").text("-").attr('onclick', 'f_add()'));
var selector_campos = $("<div>").append(mis_campos).append(botones);
//var f_add = function(){ $(".campos").append(selector_campos) };
var f_add = function(){ $("#campos").append(selector_campos.clone()) };
$(document).ready(function(){
f_add();
});
// A $( document ).ready() block.
$( document ).ready(function() {
console.log( "document loaded" );
});
$( window ).load(function() {
console.log("window loaded");
});
</script>
</head>
<body>
<h1> hey </h1>
<div id="campos"></div>
</body>
</html>