Disabling undo/redo in an HTML input field

£可爱£侵袭症+ 提交于 2020-01-02 05:44:12

问题


I am using asp.net input fields and they automatically provide undo/redo functionality. I am using JavaScript to format the value of the input field, however this ruins the undo/redo history.

  • Is there a way to disable the undo/redo feature?

    or

  • Is there a way to interact with the undo/redo history to add the correct values?

回答1:


Using JavaScript, try replacing the text field with a new one and then setting the value. New field, new undo buffer, right?

jQuery:

$('#theTextField').after('<textarea id="theTextField2"></textarea>').remove();
$('#theTextField2').attr('id','theTextField');


来源:https://stackoverflow.com/questions/7453927/disabling-undo-redo-in-an-html-input-field

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!