
problema raro en console
Publicado por tony (1 intervención) el 29/11/2021 21:02:28
Uncaught TypeError: $(...).eq(...).files is undefined
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
$(document).ready(function(){
$(".menu").siblings().hide();
$("#submit").show();
//$("input[type='submit']").show();
//$("input[type='file']").show();
$("#gallery").show();
//$('.menu, .submenu, .scarpe').val('select');
$(".menu, .submenu1, .submenu2, .misure_magliette").on("change", function(){
val = $(this).val();
console.log(val);
$("."+val).show();
console.log($(this).attr("class"));
if($(this).attr("class") == "menu"){
$("."+val).show();
$("."+val).siblings().hide();
$("#submit").show();
$(".menu").show();
console.log("ok")
}
if($(this).attr("class") == "submenu1" || $(this).attr("class") == "submenu2"){
$("#gallery").show();
}
// $("."+val).val('select');
// $("."+val).siblings().hide();
});
$("input[type='number']").mouseout(function(){
console.log($(this).val());
})
$("input[type='submit']").mouseover(function(){
})
//var fileInput = document.getElementById('file_input');
//fileInput = $(".file_input");
cont =0;
rotate = 0;
$(".file_input").eq(cont).on("change", () => {
//cont++;
//rotate -= 90;
div = document.createElement("div");
for(let file of $(".file_input").eq(cont).files) {
var image = file
if (image) {
var imageElement = new Image();
imageElement.src = URL.createObjectURL(image);
imageElement.width = 100;
var imageElement2 = new Image();
imageElement2.src = "https://img.icons8.com/material-two-tone/24/000000/rotate-left.png";
//imageElement2.width = 100;
var imageElement3 = new Image();
imageElement3.src="https://img.icons8.com/material-rounded/24/000000/rotate-right.png";
var imageElement4 = new Image();
imageElement4.src="https://img.icons8.com/material-two-tone/24/000000/remove-image.png";
document.getElementById('gallery').appendChild(div);
div.appendChild(imageElement2);
div.appendChild(imageElement3);
div.appendChild(imageElement4);
div.appendChild(imageElement);
$(imageElement2).click(function(){
rotate = rotate - 90;
// rrotate = rotate + 90;
console.log(7)
$(imageElement).css("transform", "rotate("+rotate+"deg)");
// $(imageElement).css("transform", "rotate("+lrotate+"deg)");
});
$(imageElement3).click(function(){
// lrotate = rotate - 90;
rotate = rotate + 90;
console.log(7)
// $(imageElement).css("transform", "rotate("+lrotate+"deg)");
$(imageElement).css("transform", "rotate("+rotate+"deg)");
});
$(imageElement4).click(()=>{
$(imageElement).css("display","none");
})
}
}
$("img").click(function(){
console.log(4);
})
cont++
});
//cont=0;
$("#addimg").click(()=>{
// cont++
$(".file_input").eq(cont).click();
})
/*
imageElement2.addEventListener("click", ()=>{
})
*/
})
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<!DOCTYPE html>
<html>
<head>
<link href="custom.css" rel="stylesheet">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<meta name="viewport" content="width=device-width">
</head>
<body>
<form action="output2.php" method="post">
<select class="menu" name="product">
<option value="select">seleziona articolo</option>
<option value="scarpe">scarpe</option>
<option value="magliette">magliette</option>
</select>
<div id="" class="scarpe">
<select name="scarpe" class="submenu1">
<option value="select">selezione genere</option>
<option value="scarpe_maschio">maschio</option>
<option value="scarpe_femmina">femmina</option>
</select>
</div>
<div id="" class="magliette">
<select name="sesso_magliette" class="submenu2">
<option value="select">seleziona genere</option>
<option value="magliette_maschio">maschio</option>
<option value="magliette_femmina">femmina</option>
</select>
</div>
<!-- opzioni del submenu-->
<div id="opt" class="num_scarpe scarpe_femmina scarpe_maschio">
<p>seleziona numero di scarpe</p>
<input type="number" name="scarpe_num" class="" value=0>
</div>
<div id="opt2" class="misure_magliette magliette_femmina magliette_maschio">
<select name="misure_magliette" class="submenu misure_magliette">
<option value="select">seleziona taglia</option>
<option value="xs">xs</option>
<option value="s">s</option>
<option value="m">m</option>
<option value="l">l</option>
<option value="xl">xl</option>
</select>
</div>
<!-- <input type="file" name="file" id="file_input" multiple> -->
<input type="file" name="f1" class="file_input">
<input type="file" name="f2" class="file_input">
<input type="file" name="f3" class="file_input">
<input type="file" name="f4" class="file_input">
<input type="file" name="f5" class="file_input">
<div id="gallery">
<img src="https://img.icons8.com/material-outlined/100/000000/add-image.png" id="addimg"/>
</div>
<!--<input type="submit" name="submit"> -->
<button id="submit">submit</button>
</form>
</body>
<script src="main.js"></script>
</html>
Valora esta pregunta


0