私信  •  关注

Jack Bashford

Jack Bashford 最近创建的主题
Jack Bashford 最近回复了
6 年前
回复了 Jack Bashford 创建的主题 » 如何删除ol child在jquery中没有li的li元素?

您的代码正在遍历所有 li 包含在 #myUL .使用一级子选择器 > 以下内容:

$(document).ready(function() {
  $('#myUL > li').each(function() {
    var lenLi = $(this).find('ol').children('li').length;
    if (lenLi == 0) {
      $(this).remove();
    }
  })
})
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>

<ol id="myUL">
  <li>Hello 1</li>
  <li>Hello 2
    <ol></ol>
  </li>
  <li>Hello 3
    <ol>
      <li>Hello 3.1</li>
      <li>Hello 3.2</li>
      <li>Hello 3.3</li>
    </ol>
  </li>
</ol>
6 年前
回复了 Jack Bashford 创建的主题 » mongodb:无法使用google云函数向mongodb atlas服务器插入多个

docs 以下内容:

document 要插入到集合中的文档数组。

只需在对象周围添加一对方括号:

let newData = [{
    transId: trans['trans_id'] ? trans['trans_id'] : '',
    sender: trans['ledger_to_id'] ? trans['ledger_to_id'] : '',
    receiver: trans['ledger_from_id'] ? trans['ledger_from_id'] : '',
    createdAt: trans['created_at'] ? trans['created_at'] : '',
    amount: trans['cost'] ? trans['cost'] : ''
}];
6 年前
回复了 Jack Bashford 创建的主题 » jquery未在html表单中定义[已关闭]

您需要包括jquery本身:

<script src="https://code.jquery.com/jquery-3.3.1.js"></script>
<script src="https://code.jquery.com/ui/1.10.2/jquery-ui.js" ></script>
<script src="js/script.js"></script>