单击图标时打开图像对话框

时间:2018-05-23 07:05:42

标签: javascript

<label class="label" data-toggle="tooltip" title="Change your avatar">
<img class="rounded" id="avatar" src="https://avatars0.githubusercontent.com/u/3456749?s=160" alt="avatar">
       <input type="file" class="sr-only" id="input" name="image" accept="image/*">
     </label>

当图像单击如何将其设置为图标时,将打开

选择图像对话框。单击图标时弹出!

<label class="btn-aux" data-toggle="tooltip" title="Change your avatar" for="profile_image" style="cursor: pointer;"><i class="ion ion-edit"></i>
         <input type="file" class="sr-only" id="input" name="image" accept="image/*"></label>

这里什么都没发生.....!该怎么做

1 个答案:

答案 0 :(得分:0)

你是说这个吗?

&#13;
&#13;
.ion {
  display: block;
  width: 32px;
  height: 32px;
  cursor: pointer;
  background: #fff url(https://cdn.sstatic.net/Sites/stackoverflow/img/favicon.ico) 0 0 no-repeat
}
#input {
  display: none
}
&#13;
<label class="label" data-toggle="tooltip" title="Change your avatar">
  <i class="ion"></i>
  <input type="file" class="sr-only" id="input" name="image" accept="image/*">
</label>
&#13;
&#13;
&#13;