JS如何在复制粘贴后启用输入

时间:2017-07-17 04:11:24

标签: javascript jquery prop

好的,我有一个禁用的提交按钮,一旦用户开始输入,该按钮就被启用了。 但是,如果用户决定复制并粘贴其电子邮件,则不会启用它。 这是代码:

JS:

<div class="_form_element _x86892465 _full_width " >
              <label class="_form-label">
                Email*
              </label>
              <div class="_field-wrapper">
                <input type="text" name="email" placeholder="Enter your email address..." required/>
              </div>
            </div>
            <div class="_button-wrapper _full_width">
              <button id="_form_15_submit" class="_submit" type="submit">
                Subscribe
              </button>
            </div>

HTML:

on("change", function() {});

我尝试过使用变更即[ { "name": "Sample 1", "embed": 10, "interactive": 10, "rapidDev": 7, "support": 7, "predictive": 4, "modelDev": 3, "cost": 2 }, { "name": "Sample 2", "embed": 7, "interactive": 6, "rapidDev": 7, "support": 7, "predictive": 4, "modelDev": 3, "cost": 10 }, { "name": "Sample 3", "embed": 10, "interactive": 10, "rapidDev": 2, "support": 2, "predictive": 2, "modelDev": 2, "cost": 10 }, { "name": "Sample 4", "embed": 2, "interactive": 7, "rapidDev": 7, "support": 7, "predictive": 10, "modelDev": 3, "cost": 8 } ]

不确定如何解决这个问题。 之前有人遇到过这个问题。 干杯

2 个答案:

答案 0 :(得分:-1)

使用onpaste事件

$("._x86892465 ._field-wrapper input").on("paste", function() {
    $("#colophon #_form_15_submit").prop("disabled", false).css({"cursor" : "pointer"});
});

工作示例:https://jsfiddle.net/vineeshmp/2m8utzye/

答案 1 :(得分:-4)

$( "._x86892465 ._field-wrapper input" ).change(function() {
    $("#colophon #_form_15_submit")
    .prop("disabled", false).css({"cursor" : "pointer"});
});