{"id":1810,"date":"2017-01-27T12:55:12","date_gmt":"2017-01-27T03:55:12","guid":{"rendered":"http:\/\/elink.tokyo\/?p=365"},"modified":"2017-09-17T12:10:25","modified_gmt":"2017-09-17T03:10:25","slug":"jq-getcount-li","status":"publish","type":"post","link":"https:\/\/greentown.tokyo\/?p=1810","title":{"rendered":"\u3010jQuery\u3011table\u30bf\u30b0\u306e\u4e2d\u306b\u3042\u308bli\u306e\u4ef6\u6570\u3092\u53d6\u5f97\u3057\u305f\u3044"},"content":{"rendered":"<p>\u666e\u6bb5\u304b\u3089CSS\u3082jquery\u3082\u306a\u3093\u3068\u306a\u304f\u3001\u306a\u3093\u3068\u306a\u30fc\u304f\u4f7f\u3063\u3066\u3044\u308b\u306e\u3067\u3001\u3044\u3064\u307e\u3067\u305f\u3063\u3066\u3082\u30d3\u30ae\u30ca\u30fc\u306e\u307e\u307e\u3002\u3002<\/p>\n<h2>\u30c6\u30fc\u30d6\u30eb\u306e\u4e2d\u306b\u3042\u308b\u30ea\u30b9\u30c8\u306e\u4ef6\u6570\u3092\u53d6\u5f97\u3057\u305f\u3044<\/h2>\n<p>\u30b5\u30fc\u30d0\u30b5\u30a4\u30c9\u306fC#\u3067\u3059\u3002<\/p>\n<p>View<\/p>\n<pre class=\"lang:default decode:true\" title=\"view\">&lt;table id=\"tbl\"&gt;\r\n    &lt;thead&gt;\r\n        &lt;tr&gt;\r\n            &lt;th style=\"text-align:center;\" id=\"display_no\"&gt;@Html.LabelFor(m =&gt; m.First().display_no, new { @class = \"control-label\", @style = \"font-weight:bold\" })&lt;\/th&gt;\r\n            &lt;th style=\"text-align:center;\"&gt;@Html.LabelFor(m =&gt; itmFirst.name, new { @class = \"control-label\", @style = \"font-weight:bold\" })&lt;\/th&gt;\r\n            &lt;th style=\"text-align:center;\"&gt;@Html.LabelFor(m =&gt; itmFirst.enabled, new { @class = \"control-label\", @style = \"font-weight:bold\" })&lt;\/th&gt;\r\n            &lt;th style=\"text-align:center;\"&gt;@Html.LabelFor(m =&gt; itmFirst.color, new { @class = \"control-label\", @style = \"font-weight:bold\" })&lt;\/th&gt;\r\n            &lt;th style=\"display:none\"&gt;&lt;\/th&gt;\r\n        &lt;\/tr&gt;\r\n    &lt;\/thead&gt;\r\n    &lt;tbody id=\"sortable\"&gt;\r\n        @foreach (website.Models.Master.partModel itm in Model)\r\n        {\r\n            &lt;tr&gt;\r\n                &lt;td style=\"text-align:center;\" class=\"row_no\" id=\"order_num\"&gt;@itm.display_no&lt;\/td&gt;\r\n                &lt;td&gt;@itm.name&lt;\/td&gt;\r\n                &lt;td style=\"text-align:center; vertical-align:middle;\"&gt;\r\n                    @Html.CheckBoxFor(mbox =&gt; itm.boolEnabled)\r\n                    @Html.Hidden(\"enabled\", itm.enabled, \"enabled\")\r\n                &lt;\/td&gt;\r\n                &lt;td style=\"text-align:center; vertical-align:middle;\" &gt;&lt;div id=\"palette_@itm.id\"&gt;@Html.Partial(\"_ColorPalette\")&lt;\/div&gt;&lt;\/td&gt;\r\n                &lt;td style=\"display:none;\" id=\"id\"&gt;@itm.id&lt;\/td&gt;\r\n            &lt;\/tr&gt;\r\n        }\r\n    &lt;\/tbody&gt;\r\n&lt;\/table&gt;<\/pre>\n<p>@Html.Partial(&#8220;_ColorPalette&#8221;)<\/p>\n<pre class=\"lang:default decode:true \" title=\"view\">&lt;div class=\"group\"&gt;\r\n    &lt;ul&gt;\r\n        &lt;li&gt;&lt;a style=\"color:navy\"&gt;&lt;i class=\"fa fa-circle\"&gt;&lt;\/i&gt;&lt;\/a&gt;&lt;\/li&gt;\r\n        &lt;li&gt;&lt;a style=\"color:teal\"&gt;&lt;i class=\"fa fa-circle\"&gt;&lt;\/i&gt;&lt;\/a&gt;&lt;\/li&gt;\r\n        &lt;li&gt;&lt;a style=\"color:green\"&gt;&lt;i class=\"fa fa-circle\"&gt;&lt;\/i&gt;&lt;\/a&gt;&lt;\/li&gt;\r\n        &lt;li&gt;&lt;a style=\"color:purple\"&gt;&lt;i class=\"fa fa-circle\"&gt;&lt;\/i&gt;&lt;\/a&gt;&lt;\/li&gt;\r\n        &lt;li&gt;&lt;a style=\"color:maroon\"&gt;&lt;i class=\"fa fa-circle\"&gt;&lt;\/i&gt;&lt;\/a&gt;&lt;\/li&gt;\r\n        &lt;li&gt;&lt;a style=\"color:deeppink\"&gt;&lt;i class=\"fa fa-circle\"&gt;&lt;\/i&gt;&lt;\/a&gt;&lt;\/li&gt;\r\n        &lt;li&gt;&lt;a style=\"color:palevioletred\"&gt;&lt;i class=\"fa-circle\"&gt;&lt;\/i&gt;&lt;\/a&gt;&lt;\/li&gt;\r\n        &lt;li&gt;&lt;a style=\"color:lightblue\"&gt;&lt;i class=\"fa fa-circle\"&gt;&lt;\/i&gt;&lt;\/a&gt;&lt;\/li&gt;\r\n        &lt;li&gt;&lt;a style=\"color:mediumturquoise\"&gt;&lt;i class=\"fa-circle\"&gt;&lt;\/i&gt;&lt;\/a&gt;&lt;\/li&gt;\r\n    &lt;\/ul&gt;\r\n&lt;\/div&gt;<\/pre>\n<p>Javascript<\/p>\n<pre class=\"lang:js decode:true\" title=\"Javascript\">$.each($(\"#tbl tbody\").children(), function () {\r\n    \/\/alert($(this).html());  \/\/ &lt;tr&gt;\u306e\u4e2d\u8eab\u3092\u8868\u793a\u3059\u308b\u3002\r\n    alert($(this).find('li').length); \/\/ \u2190\u3053\u3053\u3002\r\n});<\/pre>\n<p><span style=\"color: #ff0000;\">$(this).find(&#8216;li&#8217;).length<\/span><br \/>\n\u3053\u308c\u3067\u53d6\u5f97\u3067\u304d\u307e\u3057\u305f\u3002<br \/>\n\u3053\u308c\u3092\u63a2\u3057\u5f53\u3066\u308b\u306e\u306b\u5c0f1\u6642\u9593\u30fb\u30fb\u30fb\u3002<\/p>\n<p><img decoding=\"async\" class=\"alignnone wp-image-366 size-full\" src=\"http:\/\/elink.tokyo\/wp-content\/uploads\/2017\/01\/alert.png\" width=\"446\" height=\"183\" \/><\/p>\n<p>alert\u7d50\u679c\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>\u3055\u3089\u306b\u30ea\u30b9\u30c8\u3092\u307e\u308f\u3057\u3066\u51e6\u7406\u3055\u305b\u305f\u3044\u5834\u5408\u306f\u3053\u3046\u3002<\/p>\n<pre class=\"lang:java decode:true \">$.each($(\"#tbl tbody\").children(), function () {\r\n    \/\/alert($(this).html());  \/\/ &lt;tr&gt;\u306e\u4e2d\u8eab\u3092\u8868\u793a\u3059\u308b\u3002\r\n    $(this).find('li').each(function () {\r\n\r\n        \/\/ \u5b50\u8981\u7d20(a)\u306e\u30d7\u30ed\u30d1\u30c6\u30a3\u5024\u3092\u8868\u793a\u3059\u308b\r\n        alert($(\"a\", this).css('color'));\r\n\r\n        return false;\r\n    });\r\n    return false;\r\n});<\/pre>\n<p>\u3061\u306a\u307f\u306b\u3001each\u304b\u3089\u629c\u3051\u305f\u3044\u5834\u5408\u306f\u300creturn\u300d\u3060\u3051\u3058\u3083\u3060\u3081\u3002<br \/>\n\u300creturn false\u300d\u3068\u66f8\u304f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u666e\u6bb5\u304b\u3089CSS\u3082jquery\u3082\u306a\u3093\u3068\u306a\u304f\u3001\u306a\u3093\u3068\u306a\u30fc\u304f\u4f7f\u3063\u3066\u3044\u308b\u306e\u3067\u3001\u3044\u3064\u307e\u3067\u305f\u3063\u3066\u3082\u30d3\u30ae\u30ca\u30fc\u306e\u307e\u307e\u3002\u3002 \u30c6\u30fc\u30d6\u30eb\u306e\u4e2d\u306b\u3042\u308b\u30ea\u30b9\u30c8\u306e\u4ef6\u6570\u3092\u53d6\u5f97\u3057\u305f\u3044 \u30b5\u30fc\u30d0\u30b5\u30a4\u30c9\u306fC#\u3067\u3059\u3002 View &lt;tab &#8230; <\/p>\n","protected":false},"author":1,"featured_media":1769,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[79],"tags":[],"class_list":["post-1810","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-note"],"_links":{"self":[{"href":"https:\/\/greentown.tokyo\/index.php?rest_route=\/wp\/v2\/posts\/1810"}],"collection":[{"href":"https:\/\/greentown.tokyo\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/greentown.tokyo\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/greentown.tokyo\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/greentown.tokyo\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1810"}],"version-history":[{"count":1,"href":"https:\/\/greentown.tokyo\/index.php?rest_route=\/wp\/v2\/posts\/1810\/revisions"}],"predecessor-version":[{"id":1866,"href":"https:\/\/greentown.tokyo\/index.php?rest_route=\/wp\/v2\/posts\/1810\/revisions\/1866"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/greentown.tokyo\/index.php?rest_route=\/wp\/v2\/media\/1769"}],"wp:attachment":[{"href":"https:\/\/greentown.tokyo\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1810"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/greentown.tokyo\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1810"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/greentown.tokyo\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1810"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}