LoginSignup
15
17

More than 5 years have passed since last update.

jQueryを使ってタグの内容が空の場合はそのタグを削除する

Last updated at Posted at 2014-06-11

今後使いそうなのでメモ

$(function() {
     $("p:empty").remove();
});

親要素を消したいとき

.parent()を使う

tableの場合
$(function() {
     $("table tr td:empty").parent("tr").remove();
});
15
17
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
15
17