什么是这个Jquery的JS等价物?

时间:2017-01-07 06:27:12

标签: javascript jquery

 @Override
 protected void onCreate(Bundle savedInstanceState) {
 super.onCreate(savedInstanceState);

 Intent alarmIntent = new Intent();
 alarmIntent.setAction(action);
 PendingIntent pendingIntent = PendingIntent.getActivity(MainActivity.this, 0, alarmIntent,
                                PendingIntent.FLAG_NO_CREATE);
 if (pendingIntent != null) {
     Log.d(TAG, "has pending intent");
    } 
 else {
     Log.d(TAG, "no pending intent");
    }
}

问题涉及二维数组。 我知道第一部分是这样的:

$('.board').children().eq(i).children().eq(Math.abs(j-6)).html("<div class='black-piece'></div>")

想知道如何获得j-6,这是数组中的列方面以及如何输入创建的div。

1 个答案:

答案 0 :(得分:0)

您可以查看demo

<div class="board">
   <div>
       <div>Inner Child-1.1</div>
      <div>Inner Child-1.2</div>
      <div>Inner Child-1.3</div>
      <div>Inner Child-1.4</div>
      <div>Inner Child-1.5</div>
   </div>
   <div>
      <div>Inner Child-2.1</div>
      <div>Inner Child-2.2</div>
      <div>Inner Child-2.3</div>
      <div>Inner Child-2.4</div>
      <div>Inner Child-2.5</div>
   </div>
</div>

var board = document.getElementsByClassName("board")[0].children[0].children[1];
board.innerHTML = "<div class='black-piece'>New HTML</div>";