1
2
3
4
5
6
7
8
9
10
11
12
var a = "";
= document.create("input");
a.setAttribute('type','file');
// console.log(a) -> <input type="file/>
a.onchange= function(){
 alert("change test");
}
//test ie10
a.style.display = 'none'
document.Selector('body').appendChild(a);
 
a.click();
cs


* ie11, Edge, Chrome에서는 input type ="file" 으로 만들어진 a 변수가 onclick으로 잘 되는데


ie 10에서만 안되어서

해당 부분을 display="none"으로 안보이게 한후

body에다가 append로 붙여서 다시 생성하였더니

on click event가 생성되었다.


이런방법으로도 해결 하였지만.. 될수있으면 낮은 버전의 브라우저는 안썼으면 좋겠다. ㅠㅠ

이상한 예외처리가 너무 많아서 어렵다 ㅠㅠ 


+ Recent posts