问题
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