通过jquery创建的DOM元素没有显示出来

时间:2017-04-20 18:14:32

标签: jquery dom

我正在使用jquery在html中创建一个具有自动填充输入框的功能,在选择自动填充中的用户时会显示有关它们的信息,但是有些信息是diplay但是标签功能无法正常显示。

下面是代码

function showcontent(data) {
    if (data.responseText) {
        var response = JSON.parse(data.responseText);
        $('#name').html('<i class="ion-ios-person-outline profileicon"></i> ' + response.User.FullName);
        $('#desig').html('<i class="ion-ios-briefcase-outline profileicon"></i> ' + response.User.Designation);
        $('#dept').html('<i class="ion-ios-people-outline profileicon"></i> ' + response.User.Department);
        $('#loc').html('<i class="ion-ios-location-outline profileicon"> ' + response.User.Location);
        $('#phone').html('<i class="ion-ios-telephone-outline profileicon"></i> ' + response.User.Phone);
        $('#email').html('<i class="ion-ios-email-outline profileicon"></i> ' + response.User.Email);

        var tabs = [];
        var tabContainer = [];
        var ratings = [];
        for (var i = 0; i < response.Ratings.length; i++) {
            ratings.push('<div class="col-md-5ths col-xs-6"><center class="feedbackiconDiv"><div class="feed1"><img src="../Content/Images/' + response.Ratings[i].RatingImage + '" /></div><span class="captionImage1">' + response.Ratings[i].RatingName + '</span></center></div>');
        }

        var ratingHTML = ratings.join(' ');
        tabs.push('<ul class="tabs" style="">');

        tabContainer.push('<div class="tab_container">');
        for (var i = 0; i < response.Skills.length; i++) {
            if (i === 0) {
                tabs.push('<li class="active" data-toggle="tab" rel="tab' + i+1 + '">' + response.Skills[i].SkillName + '</li>');
                //tabContainer.push('<h3 class="d_active tab_drawer_heading" rel="tab' + i + 1 + '">' + response.Skills[i].SkillName + '</h3>');
            } else {
                tabs.push('<li data-toggle="tab" rel="tab' + i + 1 + '">' + response.Skills[i].SkillName + '</li>');
                //tabContainer.push('<h3 class="tab_drawer_heading" rel="tab' + i + 1 + '">' + response.Skills[i].SkillName + '</h3>');
            }

            tabContainer.push('<div id="tab' + i + 1 + '" class="tab_content"><p>' + response.Skills[i].Description + '</p><div class="row"><div class="col-xs-12 col-sm-12 col-md-12 col-lg-12" style=""><div class="row">' + ratingHTML + '</div></div></div></div>');
        }

        tabs.push('</ul>');
        tabContainer.push('</div>');

        $('#feedbackTab').html(tabs.join(' ') + tabContainer.join(' '));
    }
  

$(&#39;#feedbackTab&#39;)。html(tabs.join(&#39;&#39;)+ tabContainer.join(&#39;&#39;));

tabs[]正在显示,但tabContainer未显示在浏览器中,但是当我在浏览器中检查后看到代码时,它会显示正确的代码。

请帮忙

1 个答案:

答案 0 :(得分:0)

如果他们隐藏了tab_content,请检查css或任何js。