0

嗨,我正在尝试隐藏表单并在单击发送按钮时显示一条消息。我已经尝试了很多事情它在 document.ready 函数中,但这似乎导致的错误比它修复的要多。这就是代码目前的样子;

                    <form class="contact">
                    <p class="contact-name">
                        <label class="contact-author">Name*</label>
                        <input class="input-name" type="text" name="name" placeholder="Your name"><br>
                    </p>
                    <p class="contact-email">
                        <label class="contact-author">Email*</label>
                        <input class="input-email" type="email" name="email" placeholder="Email Address"><br>
                    </p>
                    <p class="contact-msg">
                        <label class="contact-author">Message*</label>
                        <textarea class="input-msg" type="text" name="comments" maxlength="1000" placeholder="Enter your message"></textarea><br>
                    </p>
                    <p class="contact-send">
                        <input class="input-send" id="send" type="submit" value="Send" name="submit">
                    </p>
                </form>
                        <div id="send-msg" style="visibility:hidden;">
                            <p>Thanks your message has been sent!</p>
                        </div>


$('#send').click(function() {
$('.contact').hide();
$('#send-msg').show();
)};

JSFiddle - http://jsfiddle.net/rvfhu/

4

1 回答 1

2

一些东西:

  1. 你忘了在你的小提琴中包含 jQuery
  2. 您的关闭)}实际上应该是})
  3. 当使用 CSS 隐藏元素时,使用display: none;

更新小提琴:http: //jsfiddle.net/rvfhu/6/

于 2013-10-13T17:03:23.253 回答