Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hiding an input file inside a button Semantic-UI

Is there a way to make this work using Semantic-ui?

I have this button, which look OK, but the input file never gets called.

<div class="ui icon big button">
        <i class="cloud icon"></i>
        <input type="file" id="hidde-new-file" style="display: none">
 </div>
like image 413
carloss medranoo Avatar asked Dec 10 '22 22:12

carloss medranoo


1 Answers

I'd recommend adding a label pointing to your hidden input. Labels trigger their input when clicked. All native without JS.

<div>
  <label for="hidden-new-file" class="ui icon button">
    <i class="cloud icon"></i>
    Open File
  </label>
  <input type="file" id="hidden-new-file" style="display: none">
</div>
like image 158
Per Wiklander Avatar answered Jan 07 '23 05:01

Per Wiklander