質問するログイン新規登録

質問編集履歴

2

参考の追加

2018/10/03 02:05

投稿

kuria
kuria

スコア12

title CHANGED
File without changes
body CHANGED
@@ -57,6 +57,8 @@
57
57
  ```ここに言語名を入力
58
58
  html,javascript
59
59
  ```
60
+ ```参考
61
+ https://qiita.com/nacasora/items/713919f7a56024f5c59f
60
62
 
61
63
  ### 詳細
62
64
  repliesですべて表示しているので、バラバラに出力してリスト表示すればいい話なのですが、どこに<li>を付けたらいいのかを教えていただきたいです。

1

html のソース記入

2018/10/03 02:04

投稿

kuria
kuria

スコア12

title CHANGED
File without changes
body CHANGED
@@ -19,6 +19,41 @@
19
19
  <div class="locate1">${locate1}</div>
20
20
  <div class="locate2">${locate2}</div>
21
21
  <button class="delete" onclick="deleteReply('${id}')">delete</button> </div>`
22
+ ```html
23
+ <script>
24
+ $(function () {
25
+ searchWord = function(){
26
+ var searchText = $(this).val(), // 検索ボックスに入力された値
27
+ targetText;
28
+
29
+ $('.target-area li').each(function() {
30
+ targetText = $(this).text();
31
+
32
+ if (targetText.indexOf(searchText) != -1) {
33
+ $(this).removeClass('hidden');
34
+ } else {
35
+ $(this).addClass('hidden');
36
+ }
37
+ });
38
+ };
39
+ </script>
40
+ </head>
41
+ <body>
42
+ <body>
43
+ <div class="wrapper">
44
+ <div class="search-area">
45
+ <form>
46
+ <input type="text" id="search-text" placeholder="検索ワードを入力">
47
+ </form>
48
+ <div class="search-result">
49
+ <div class="search-result__hit-num"></div>
50
+ <div id="search-result__list"></div>
51
+ </div>
52
+ </div>
53
+
54
+ <ul class="target-area">
55
+ <div id="replies"></div>
56
+ </div><!-- /.wrapper -->
22
57
  ```ここに言語名を入力
23
58
  html,javascript
24
59
  ```