【问题标题】:how to wait to append the data until after the form data has been added?如何等到添加表单数据后才追加数据?
【发布时间】:2012-05-16 04:50:01
【问题描述】:

当我单击#screenrId 时,它会提交默认数据,而没有时间添加用户输入的新数据。如何等到表单输入字段数据添加完成后再追加数据?

http://jsfiddle.net/XVCVE/1/

<script type="text/javascript">    
$(document).ready(function() {      
    Screenr.Recorder( { subject:""}).appendTo("screenrId");        
});        
</script>     
<form>    
    <h4>Subject <input name="subject" id='subject' type="text" ></h4>
</form>
<div id="screenrId" ></div>   

我想在添加表单数据之前将其添加到 screen.recorder 函数吗? Screenr.Recorder( { subject:""})

【问题讨论】:

标签: javascript forms jquery javascript-events


【解决方案1】:

很确定我刚刚修复了它:http://jsfiddle.net/XVCVE/3/

问题:

  1. jsfiddle 中的“javascript”部分假定为原始 javascript,没有 &lt;script&gt; 标记,因此我将该代码移至顶部。
  2. 您有一种非常奇怪的方法来确保使用正确的 HTTP 协议(​​HTTP 或 HTTPS)来加载第 3 方库,而如果您只是 不编写,浏览器会自动执行此操作> http:https:

然后,按钮稍稍延迟后出现。

【讨论】:

  • 如何将表单输入数据添加到 screen.recorder({subject:""})appendTo("ScreenerId");
  • 什么意思?以什么方式追加表单数据到什么?
  • 该按钮出现在我的浏览器中,只是不在 jfiddle 中。那不是问题所在。当用户输入主题字段并按下按钮调用屏幕录像机时,如何在调用屏幕录像机之前将用户输入的这个表单字段数据添加到 screen.recorder 函数中?
  • 你能给我看一下这个屏幕录像机对象的 API 文档吗?我以前从未遇到过,但答案可能就在那里。
  • 抱歉,在 API 上找到了另一个页面:business.screenr.com/api/settings.php 您需要获取对recorder 对象的引用并调用setSubject 方法,可能使用类似$('#subject').on('change', function() { ... 的方法
猜你喜欢
  • 2020-03-13
  • 2023-03-14
  • 2021-08-22
  • 2013-01-22
  • 2018-09-06
  • 1970-01-01
  • 2014-07-09
  • 2011-02-03
  • 1970-01-01
相关资源
最近更新 更多