如何复制隐藏的输入值属性,对其进行操作,然后使用单击功能更改它?更准确地说:
这个:
<input type="hidden" id="destination" value="/change1/change2/fixed-part" />
对此:
<input type="hidden" id="destination" value="/changedtext/fixed-part" />
我做了一些处理,但无法得到想要的结果。到目前为止,我得到了该值,对其进行了操作(不确定它是否正常工作),但无法将其替换为原始值。
这是 jsfiddle: https://jsfiddle.net/3ry4cc79/1/
最佳答案
试试这个,
document.getElementById('destination').value = "/changedtext/fixed-part";
关于javascript - 根据原始值更改输入值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43519305/