# Document getElementById check if not null

> Check if element is not null.

- Canonical: https://preview.arshadmehmood.com/today-i-learned/javascript/document-getelementbyid-check-if-not-null/
- Section: javascript
- Author: Arshad Mehmood

Check if element is not null.

```js
var element = document.getElementById('something');
if (element != null && element.value == '') {
}
```

