在HTML输入字段中禁用撤销/重做 [英] Disabling undo/redo in an HTML input field

查看:90
本文介绍了在HTML输入字段中禁用撤销/重做的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用asp.net输入字段,它们自动提供撤销/重做功能。我使用JavaScript来格式化输入字段的值,但是这会遗失撤消/重做历史记录。




  • 有没有办法禁用撤销/重做功能?




  • 是否有方法与撤销/重做历史记录交互以添加正确的值?


解决方案

使用JavaScript,请尝试用新文本字段替换文本字段,然后然后设置值。新字段,新的撤消缓冲区,对吗?

jQuery:

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


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?

解决方案

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');

这篇关于在HTML输入字段中禁用撤销/重做的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆