I uses bootstrap 3 and create a dropdownbutton. With the first option "Image" I will open a file selectbox.
<div class="btn-group pull-right" style="margin-top:17px; margin-left:15px">
<button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown">
Media toevoegen <span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu">
<li><a class="image" href="#">Image</a></li>
<li><a class="youtube" href="#">YouTube</a></li>
<li><a class="soundcloud" href="#">SoundClound</a></li>
</ul>
</div>
With some jquery I can trigger with the class a function:
$(document).ready( function () {
$(".image").click(function(){
alert("Image is chosen");
});
....
But how can I trigger a file select box? Normaly I uses in the html-code:
<input type="file" name="image" class="image" id="upload_image" style="display:none" />
But I can't use it between the li tags. Does anybody know?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…