Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Locked
0

Is it possible to hide empty list items in a web app?

Explorer ,
Apr 24, 2014 Apr 24, 2014

Copy link to clipboard

Copied

Hi,

as you can see on the here included image, below "Ihr Profil", there are 10 items provided by a webapp which are customized in the details.htm page as an unordered list.

In this case there are only 6 items filled out, the rest is empty, but the empty items do appear. Is it possible to tell the details page, not to display those empty items?

Details view.png

Thanks a lot for your interest and help

TOPICS
Web apps

Views

2.6K
Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Explorer , Apr 24, 2014 Apr 24, 2014

There are ways to do this with jQuery, but an easier way would be to use CSS.

ul li:empty {

   display: none;

}

Though this will not work in IE8/7, if that is a deal breaker you will need to use jQuery: http://jsfiddle.net/F7ZWV/

$("ul li").each(function() {

                                                  var $this = $(this);

          if($this.text() == ""){

             $this.remove();

          }

});

Votes

Translate
Explorer ,
Apr 24, 2014 Apr 24, 2014

Copy link to clipboard

Copied

There are ways to do this with jQuery, but an easier way would be to use CSS.

ul li:empty {

   display: none;

}

Though this will not work in IE8/7, if that is a deal breaker you will need to use jQuery: http://jsfiddle.net/F7ZWV/

$("ul li").each(function() {

                                                  var $this = $(this);

          if($this.text() == ""){

             $this.remove();

          }

});

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 24, 2014 Apr 24, 2014

Copy link to clipboard

Copied

LATEST

Chad, it works, thank you so much

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines