How to check input file is empty, and also display an alert if png format is selected using jquery

后端 未结 4 1506
谎友^
谎友^ 2021-02-07 11:23

I have got an input file upload , need to check which file is uploaded / if no file is selected by the client using jquery.



        
4条回答
  •  没有蜡笔的小新
    2021-02-07 11:54

    This demo works in IE9 + Chrome:

    http://jsfiddle.net/brdFq/
    

    using Jquery, you get the val();

    a quick implementation here:

    function hasFile(selector){
        //if there is a value, return true, else: false;
        return $(selector).val()? true: false;
    }
    

提交回复
热议问题