看起来像这样:我为这个文件添加字符..它显示如下
我需要这样重命名:
我想按句点自动重命名空格,并删除其他字符,例如[,()!;'\[\]}{=]
老实说我没有剧本,因为我不知道该怎么做,我有一个剧本,但是那是一场灾难哈哈;我打破了所有的HTML:/
我只需要修改输入中的文本。 javascript或jquery中的脚本
我澄清说,案文总是不同的
我给你一个jsfiddle https://jsfiddle.net/qwertyip/j4dcsL7n/12/
希望您能帮助我,问候
最佳答案
我不确定何时要修改该值,但这将为您更新该值:
// Get a reference to the element in question
let renameThese = Array.from(document.querySelectorAll("input[name^='rename']"));
// Loop through all the elements to be renamed
renameThese.map(el =>
// Replace the spaces with periods and remove all the other characters.
el.value = el.value.replace(/\ /g, '.').replace(/[\[\]\{\}\(\)\;\!\;\'\=]/g, ''));
<table id="list-files" class="table table-striped table-condensed table-hover">
<thead>
<tr>
<th width="35">
<div class="checkbox-custom checkbox-default">
<input type="checkbox" id="select-all-files" checked="">
<label for="select-all-files"></label>
</div>
</th>
<th>File</th>
<th>Size</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<div class="checkbox-custom checkbox-default"><input name="files[]" checked="" type="checkbox" value="2"><label></label></div>
</td>
<td class="pt-none pb-none">
<div>
<div class="pull-left mt-xs mr-xs">PDF Shaper Professional v8.9 (2-click run) / </div>
<div style="overflow:hidden"><input class="form-control input-sm m-none" style="background-color: transparent" type="text" name="rename[2]" value="PDF S[]{}haper Professional v8.9 (2-click run).exe"></div>
</div>
</td>
<td>17.2 MiB</td>
</tr>
<tr>
<td>
<div class="checkbox-custom checkbox-default"><input name="files[]" checked="" type="checkbox" value="2"><label></label></div>
</td>
<td class="pt-none pb-none">
<div>
<div class="pull-left mt-xs mr-xs">PDF Shaper Professional v8.9 (2-click run) / </div>
<div style="overflow:hidden"><input class="form-control input-sm m-none" style="background-color: transparent" type="text" name="rename[2]" value="PDF S[]{}haper Professional v8.9 (2-click run).exe"></div>
</div>
</td>
<td>17.2 MiB</td>
</tr>
</tbody>
</table>
注意:如果您想在更新值时留下评论,请留下评论并进行更新,否则,您可以开始。