Google日历编辑事件 - 描述在由jQuery编辑时未保存

问题描述:

我正在尝试编写Chrome扩展程序以填写Google日历中的事件描述 - 编辑事件窗口。但是当我使用Jquery添加文本时:$('textarea')。val('test');并保存该事件,说明不保存。有人知道如何解决这个问题吗?Google日历编辑事件 - 描述在由jQuery编辑时未保存

+0

你应该'触发()''一个或change''为textarea的input'事件。或切换到'$('textarea')。focus(); document.execCommand(“insertText”,虚假,“测试”)' – wOxxOm

+0

是帮助:)但是,当我把这个代码在不同领域的onBlur事件,并按下保存,它就会excecuted但仍没有保存:( – John

+0

通过每次onKeyUp事件调用此解决方案:)解决问题。谢谢! – John

的解决方案是通过插入JS的文本,重点领域:

 $("#myfield").keyup(function(e){ 
      //text changed, update description field 
      text_tv = $(this).val(); 
      descr.val(''); 
      descr.focus(); 
      document.execCommand('insertText', false, convert_to_tv(text_tv)); 
      $(this).focus(); 
     });