chakri
chakri

Reputation: 629

I want to change default text on "no file chosen" when we use input="file"

how to change the text "no file chosen" in this below image![][1] .

how to change the "no file chosen" text in this image Please help to me. thanks & regards chakri

Upvotes: 1

Views: 14541

Answers (1)

Chirag Mongia
Chirag Mongia

Reputation: 555

I have used CSS to hide the default text and used a label to show the new text. Have a look- http://jsfiddle.net/ZDgRG/

Choose file
input[type=file]{
    width:90px;
    color:transparent;
}

window.pressed = function(){
    var a = document.getElementById('aa');
    if(a.value == "")
    {
        fileLabel.innerHTML = "Choose file";
    }
    else
    {
        var theSplit = a.value.split('\\');
        fileLabel.innerHTML = theSplit[theSplit.length-1];
    }
};

Upvotes: 4

Related Questions