Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/443.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/74.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript单击后隐藏_Javascript_Jquery_Forms - Fatal编程技术网

Javascript单击后隐藏

Javascript单击后隐藏,javascript,jquery,forms,Javascript,Jquery,Forms,我使用此代码在单击链接后显示表单: $(function () { $('.msg').on('click', function (e) { e.preventDefault(); $(this).next('.msgarea').show(); }); }); <a href="" class="msg" id="55"> Reply </a> <form class="msgarea"> <i

我使用此代码在单击链接后显示表单:

$(function () {
    $('.msg').on('click', function (e) {
        e.preventDefault();
        $(this).next('.msgarea').show();
    });
});

<a href="" class="msg" id="55"> Reply </a>
<form class="msgarea">
    <input />
    <input type="submit" />
</form>

.msgarea{ display:none; }
现在我需要链接消息消失,代码会是什么样子?我对js一无所知

更新:

<script language="javascript" type="text/javascript">
        $('.msg').on('click', function (e) {
       e.preventDefault();
       $(this).next('.msgarea').show();
       $(this).hide();
        });
        </script>

<a href="" class="msg" id="55"> Reply </a>
        <form class="msgarea">
        <input />
        <input type="submit" />
        </form>

.msgarea{ display:none; }

在像吼叫一样的表现形式之后说隐藏像有什么问题

$('.msg').on('click', function (e) {
       e.preventDefault();
       $(this).next('.msgarea').show();
       $(this).hide();
});

谷歌使用javascript或jquery进行dom操作。$this.hide例如:是因为@user3838972吗?你看到我的演示了吗?现在我看到了问题所在:$function{也需要在那里^^^谢谢