---
name: "SelectorQuery.exec"
mode: "api"
versionRequirements:
  - { name: "Base Library", version: "2.10.0" }
title: "SelectorQuery.exec - Execute all requests"
---

## SelectorQuery.exec

> [VERSION] Base Library >= 2.10.0

### Description

Execute all queued requests. The results are assembled into an array in request order and returned as the first argument of the callback

### Parameters

`Params`

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `execCallback` | `unknown` | Yes | Completion callback; receives an array of query results. |

### Return Value

None


### Examples

#### Batch query and execute

```html
// index.tyml
<view id="header" class="header">Header</view>
<view class="content">Content area</view>
<view id="footer" class="footer">Footer</view>
```

```js
// index.js
Page({
  onReady() {
    var query = ty.createSelectorQuery();
    query.select('#header').boundingClientRect();
    query.select('#footer').boundingClientRect();
    query.exec((results) => {
      var header = results[0];
      var footer = results[1];
      console.log('Header height', header.height);
      console.log('Footer height', footer.height);
    });
  },
});
```

```css
// index.tyss
.header, .footer {
  height: 100rpx;
  background-color: #e8f4ff;
  text-align: center;
  line-height: 100rpx;
}
.content {
  height: 400rpx;
  background-color: #f5f5f5;
}
```
