删除“onclick”事件上的函数?

时间:2023-02-09 14:57:37

I am new to javascript and I have a problem with function recalling, please See image Attached

我是javascript的新手,我在功能调用方面遇到问题,请参阅图片附件

删除“onclick”事件上的函数?

but again i click on apply button it returns like

但我再次点击它返回的应用按钮就像

删除“onclick”事件上的函数?

and repeating. this need to be stopped i have set timeout function but thing is its not working. So is this possible to destroy RegisterCapcha() and recall RegisterCapcha() in every onclick on apply button ???

并重复。这需要停止我已设置超时功能,但事情是它无法正常工作。那么这可能会破坏RegisterCapcha()并在每个onclick上调用RegisterCapcha()应用按钮???

this form that show on apply button clicked

单击“应用”按钮上显示的此表单

<form method="POST" id="careersForm" action="../php/emailsend.php enctype="multipart/form-data" > 
       <tr>
        <td>First Name  </td>
        <td><input type="TextBox" name="First_Name" class="applytext" requiredfield= "true" id="First_Name"></td>
       </tr>
       <tr>
        <td>Last Name </td>
        <td><input type="TextBox" name="Last_Name" class="applytext" required id="Last_Name"></td>
       </tr>
       <tr>
        <td>E-mail  </td>
        <td><input type="email" id="emailid" name="email" class="applytext"  required onblur="validateEmail(this)" />
         <label id="valemailid" style="color:red;"></label>
        </td>
       </tr>
       <tr>
        <td>Phone</td>
        <td><input type="text" id="Phone_No" name="Phone_No_No" class="applytext" placeholder="111-111-1111"; pattern="^[0-9]{3}[0-9]{3}[0-9]{4}$" required onfocus="this.placeholder=''" onblur="if(this.placeholder == '') { this.placeholder='(1-111-111-1111)'}" onkeypress="return isNumber(event)"/><span id="Phone_NoError" style="color:lightgray"><span></td>
       </tr>
       <tr>
        <td>Attachment  </td>
        <td><input type="file" id="fileUpload" name="attachment" maxlength="50" class="applytext" style="color: rgb(51, 51, 51);"><br />
         <span id="lblError" style="color: red;"></span>
        </td>
       </tr>
       <tr>
                <td colspan="2" class="applytable" >
                    <div class="editor-field">
                        <p>
                            <label>
                                Enter the text shown below:
                                <input type="text" id="captchaText" onkeyup="javascript:EnableApply();" /></label></p>
                        <p id="captcha">
                        </p>
                    </div>
                </td>
            </tr>
       <tr>
        <td colspan="2">
         <input type="submit" id="submit" name="button" disabled="disabled" class="send-resume" value="SEND" onclick="return ValidateExtension()" style="margin-left:24%;">
         <input type="reset" value="RESET" onclick="clearForm()" style="margin-left:8%">
        </td>
       </tr>
      </form> 

JS for captcha.

JS for captcha。

<script type="text/javascript">

    function EnableApply() {
        var OriginalCaptcha = $('#careersForm').data('captchaText');
        var userCapcha = $('#captchaText').val();

        if (OriginalCaptcha == userCapcha) {

            $('#submit').removeAttr('disabled');
        }
        else {
            $('#submit').attr('disabled', 'disabled');

        }
    }

    function RegisterCapcha() {
        $("#careersForm").clientSideCaptcha({
            input: "#captchaText",
            display: "#captcha",
            pass: function () { alert("Passed!"); return false; },
            fail: function () { alert("Failed!"); return false; }
        });
    }
</script>

i have set timeout function in <span id='close' onclick="function () { setTimeout(function () { RegisterCapcha(); }, 1000) } HideContent('job-apply'); return false;"></span>

我在 < /跨度>

thanks in advance :)

提前致谢 :)

1 个解决方案

#1


0  

you should not use client side captcha... however to answer your question

你不应该使用客户端验证码...但是要回答你的问题

You may try below

你可以尝试下面

function RegisterCapcha() {
        $("#captcha").html(''); //reset the generated captcha first
        $("#captchaText").val('');
        $("#careersForm").clientSideCaptcha({
            input: "#captchaText",
            display: "#captcha",
            pass: function () { alert("Passed!"); return false; },
            fail: function () { alert("Failed!"); return false; }
        });
    }

#1


0  

you should not use client side captcha... however to answer your question

你不应该使用客户端验证码...但是要回答你的问题

You may try below

你可以尝试下面

function RegisterCapcha() {
        $("#captcha").html(''); //reset the generated captcha first
        $("#captchaText").val('');
        $("#careersForm").clientSideCaptcha({
            input: "#captchaText",
            display: "#captcha",
            pass: function () { alert("Passed!"); return false; },
            fail: function () { alert("Failed!"); return false; }
        });
    }