JQuery

211007_trigger

요옫 2021. 10. 7. 10:29

<!DOCTYPE html>

<html>

<head>

<meta charset="UTF-8">

<title>Insert title here</title>

<script src="https://code.jquery.com/jquery-3.5.0.js"></script>

</head>

<body>

<h2 style="color: blue;">Start</h2>

<h2 style="color: orange;">Start</h2>

<h2 style="color: cyan;">Start</h2>

 

<script type="text/javascript">

 $("h2").click(function() {

 

//별추가#1

$(this).append("*");

 

//별추가#2

/* $(this).html(function (idx,html) {

return html+"*";

}); */

}); 

 

setInterval(function() {

$("h2:last").trigger("click");  //이벤트 강제 발생..별추가#1 주석 풀어야 함

}, 1000);

</script>

 

<hr>

<input type="file" id="file" style="visibility: hidden;">

<img alt="" src="../image/c1.png" width="70" id="camera">

 

<script type="text/javascript">

  $("#camera").click(function() {

  $("#file").trigger("click");

  });

 

</script>

</body>

</html>

 

이미지 클릭시 파일창 열림

'JQuery' 카테고리의 다른 글

211007_animate,active,image  (0) 2021.10.08
211007_div,z-index  (0) 2021.10.07
211006_이미지의 배경사진 변경  (0) 2021.10.07
211006_on,button(영화관,영화)  (0) 2021.10.06
211006_  (0) 2021.10.06