我有 html 作为:
<div class="k-button k-upload-button">
<input id="files" name="files" type="file" data-role="upload" autocomplete="off">
<span>Select files...</span>
</div>
上面的 html 文本(标签)我无法更改。
我只想更改文本:
Select files...
收件人:
Select file
为此我尝试了:
$(".k-button.k-upload-button").find("span").text("Select file");
但这并没有奏效。
请帮帮我。我怎样才能更改文本???
编辑 1:
.k-upload-button span:before {
content: 'Select File';
position: relative;
left: 4444px;
display: inline;
}
.k-upload-button span {
position: relative;
left: -4444px;
display: inline;
}
最佳答案
CSS 解决方案
跨度从视口(viewport)中移除,其伪子元素放回原位。
CSS
.k-upload-button span {
position: relative;
left: -9999px;
}
.k-upload-button span:before {
content: 'Select file';
position: relative;
left: 9999px;
}
关于javascript - 重命名没有 id 的按钮文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25360596/