Styling an input type=“file” button

后端 未结 30 1702
终归单人心
终归单人心 2020-11-21 11:50

How do you style an input type=\"file\" button?

30条回答
  •  爱一瞬间的悲伤
    2020-11-21 12:13

    Simply simulate a click on the by using the trigger() function when clicking on a styled

    . I created my own button out of a
    and then triggered a click on the input when clicking my
    . This allows you to create your button however you want because it's a
    and simulates a click on your file . Then use display: none on your .

    // div styled as my load file button
    
    Load from backup
    // Click function for input $("#readFile").click(function() { readFile(); }); // Simulate click on the input when clicking div $("#simClick").click(function() { $("#readFile").trigger("click"); });

提交回复
热议问题