0

我对stackoverflow相当陌生,所以请记住这一点。

我下面的这段代码是一个联系表单验证器。

当用户发送他的电子邮件时,我想删除/隐藏我网页上的箭头。

箭头有一个类叫做:scroll-arrow

JAVASCRIPT:

$(function() {
// Validate the contact form
$('#contactform').validate({
    // Specify what the errors should look like
    // when they are dynamically added to the form
    errorElement: "label",
    wrapper: "td",
    errorPlacement: function(error, element) {
        error.insertBefore( element.parent().parent() );
        error.wrap("<tr class='error'></tr>");
        $("<td></td>").insertBefore(error);
    },

    // Add requirements to each of the fields
    rules: {
        name: {
            required: true,
            minlength: 2
        },
        email: {
            required: true,
            email: true
        },
        subject: {
            required: false,
            minlength: 2
        },
        message: {
            required: true,
            minlength: 10
        }
    },

    // Specify what error messages to display
    // when the user does something horrid
    messages: {
        name: {
            required: "Vul uw naam in",
            minlength: jQuery.format("Minstens {0} karakters vereist")
        },
        email: {
            required: "Vul uw e-mail in",
            email: "Vul een geldig e-mail adres in"
        },
        subject: {
            required: "Vul uw onderwerp in",
            minlength: jQuery.format("Minstens {0} karakters vereist")
        },
        message: {
            required: "Vul uw bericht in",
            minlength: jQuery.format("Minstens {0} karakters vereist")
        }
    },

    // Use Ajax to send everything to processForm.php
    submitHandler: function(form) {
        $("#send").attr("value", "Verzenden...");
        $(form).ajaxSubmit({
            target: "#response",
            success: function(responseText, statusText, xhr, $form) {
                $(form).slideUp("fast");
                $("#response").html(responseText).hide().slideDown("fast");
                $("#response").addClass("succes");
            }
        });
        return false;
    }
});
});

HTML:

在打击我的是箭头,我希望在用户提交他的联系表格后删除这个箭头/类“滚动箭头”

<div id='contactBackground'>
            <div class='container_24'>
                 <a class="scroll-arrow" href="#contactform"></a>
            </div>
        </div><!-- einde main_content --> 

这是联系表格:

        <div id="contact_page">
            <div id="gray_area">
                <div class="container_24">
                    <h1 class="grid_24">Contact</h1>
                    <h3 class="grid_12">U krijgt zo snel mogelijk een bericht terug </h3>
                </div>
            </div>
            <div class="container_24">
                <form id="contactform" action="processForm.php" method="post">
                    <table>
                        <tr>
                            <td><label for="name"></label></td>
                            <td><input placeholder="Naam" type="text" id="name" name="name" /></td>
                        </tr>
                        <tr>
                            <td><label for="email"></label></td>
                            <td><input placeholder="Email" type="text" id="email" name="email" /></td>
                        </tr>
                        <tr>
                            <td><label for="subject"></label></td>
                            <td><input placeholder="Onderwerp" type="text" id="subject" name="subject" /></td>
                        </tr>
                        <tr>
                            <td><label for="message"></label></td>
                            <td><textarea placeholder="Bericht" id="message" name="message"></textarea></td>
                        </tr>
                        <tr>
                            <td></td>
                            <td><input type="submit" value="Verzenden" id="send" class="ease_in_100" /></td>
                        </tr>
                    </table>
                </form>
                <div id="response"></div>
            </div>
        </div>

我希望你们能理解我。如果没有,不要害怕告诉我/问。

我们正在谈论的网页:[1]: http: //nathanaelbaaij.nl/contact.php

提前致谢!

4

1 回答 1

0

您可以在 sucess 函数中添加$("a.scroll-arrow").hide()

success: function(responseText, statusText, xhr, $form) {
            $(form).slideUp("fast");
            $("#response").html(responseText).hide().slideDown("fast");
            $("#response").addClass("succes");
            $("a.scroll-arrow").hide(); //new line
        }
于 2013-10-15T18:51:17.997 回答