0
There is no way to change the text within the input
, each browser renders the element in its own way, but there is a way to use some workaround to resolve. An alternative is to add a label of its own that overlaps with the original, allowing you to use any text you want:
function fileChange() {
var e = document.getElementById('file');
if(e.value == "")
{
fileLabel.innerHTML = "Nenhum arquivo selecionado";
}
else
{
var theSplit = e.value.split('\\');
fileLabel.innerHTML = theSplit[theSplit.length-1];
}
}
fileChange();
input[type=file]{
color:transparent;
}
#fileLabel {
margin-left: -160px
}
<div>
<input type='file' title="Selecione um arquivo" id="file" onchange="fileChange()" >
<label id="fileLabel">Nenhum arquivo selecionado</label>
</div>
could you start Vb? is because there is an error in theSplit
– José Gomes
but that part is
Javascript
cannot be executed inVB
:) this part must be on the page (vbhtml, html, aspx, ascx, etc) or in a file.js
– Ricardo Pontual
div places itself under Fileupload?
– José Gomes
actually Fileupload is inside the div, but you can do it without this div as well
– Ricardo Pontual
worked , only copied and now there are two upload items equal
– José Gomes
I don’t understand, the code won’t duplicate the
input
, it has to have only one in thediv
.. doubled the input or only the label showing the message?– Ricardo Pontual
doubled the square where you put things. There were two, but I did what you told me of ( " input[type=file]{ color:Transparent; } ) and solved my problem
– José Gomes