Styling an input type=“file” button

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

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

30条回答
  •  南方客
    南方客 (楼主)
    2020-11-21 12:18

    HTML

    SelectPicture


    CSS

    .new_Btn {
    // your css propterties
    }
    
    #html_btn {
     display:none;
    }
    

    jQuery

    $('.new_Btn').bind("click" , function () {
            $('#html_btn').click();
        });
    //edit: 6/20/2014: Be sure to use ".on" not ".bind" for newer versions of jQuery
    

    Fiddle: http://jsfiddle.net/M7BXC/

    You can reach your goals too without jQuery with normal JavaScript.

    Now the newBtn is linkes with the html_btn and you can style your new btn like you want :D

提交回复
热议问题