首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >HTML -隐藏jQuery表单

HTML -隐藏jQuery表单
EN

Stack Overflow用户
提问于 2018-06-04 07:14:00
回答 2查看 49关注 0票数 -1

当一个函数被触发时,我试图使用jQuery隐藏一个表单;然而,当我在Chrome中检查显示的页面时,表单并没有隐藏,也没有显示错误。

我使用的是jQuery:$("#showYMAward").hide();

HTML:

代码语言:javascript
复制
<form data-toggle="validator" role="form" id="showYMAwards">
        <div class="container-fluid">
            <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
                <div class="jumbotron">
                    <h3>Joey Award Update</h3>
                    <!-- Place for Group Button -->
                    <div class="input-select" id="img-container1">
                    </div>
                </div>
            </div>
        </div>
    </form>

JS:

代码语言:javascript
复制
function getYMsFunction(val_AwardID) {

    $("#showYMAward").hide();

    alert('Hidden: ');
    sessionStorage.setItem('ssAwardID', val_AwardID);

    $('#ymTable tbody > tr').remove();

    var dataToBeSent  = {
            ssAwardID : sessionStorage.getItem('ssAwardID'),
            ssAwardGroupNo : sessionStorage.getItem('ssAwardGroupNo'),
    };

    $.ajax({
        url: "GetYMandAwardDates",
        data : dataToBeSent,
        type: "POST",
        cache: false,
    })
    .fail (function(jqXHR, textStatus, errorThrown) {
        $('#ajaxGetUserServletResponse').text('An error occured getting the Youth Members');
    })
    .done(function(responseJson1a) {

        $('#showAward-container').html("");

        var dataToBeSent  = {
                ssAwardID : sessionStorage.getItem('ssAwardID'),
        };

        //Get the Award Image
        $.ajax({
            data : dataToBeSent,
            type: "POST",
            url: "AwardImageView",
            cache: false
        })
        .fail (function(jqXHR, textStatus, errorThrown) {
            if(jqXHR.responseText.includes('No Award found')){
                    $('#ajaxGetUserServletResponse').text('No Award found.');
                }else{
                    $('#ajaxGetUserServletResponse').text('An error occured getting the Award Image');
                }
        })
        .done(function(responseJson1) {
            dataType: "json";
            // JSON response to populate the Award images and dates
            $(responseJson1).appendTo($("#showAward-container"));
        });


        dataType: "json";

        // JSON response to populate the Award images and names
        $(responseJson1a).appendTo($("#ymDetails"));
    });
}

我已经在隐藏之后放置了一个警告,以防它隐藏起来,然后再次显示。事实并非如此。

EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/50671813

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档