---
sourceDocument: Xanadu API Reference
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/xanadu/api-reference

 Release :

    - xanadu

ft:locale :

    - en-US

ft:publication_title :

    - Xanadu API Reference

ft:clusterId :

    - crapiref

bundleId :

    - crapiref

workflow :

    - Creator


---

# GlideDocument - Client

# GlideDocument - Client {#ariaid-title1}

* Release version: Xanadu
* 
* Updated August 1, 2024
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 1 minute to read

The GlideDocument API provides methods to search a Document Object Model (DOM) element, a document, or a JQuery element.

You can use this API in client-side scripts using ListV2 and ListV3 APIs. The GlideDocument APIs are accessed using the `g_document` global object.

## GlideDocument - getElement(String selector, Element context) {#ariaid-title2}

Returns a node found in the specified DOM based context or created from the HTML context.
{#r_GDOC-getElement_S_O__table_vnz_fhs_pv__entry__3}

| Name | Type | Description |
|-|-|-|
| selector | String or Object | Selector expression |
| context | String or Object | Optional. DOM Element, document, or JQuery object to search. |
[Table 1. Parameters]

{#r_GDOC-getElement_S_O__table_vnz_fhs_pv} {#r_GDOC-getElement_S_O__table_wnz_fhs_pv__entry__2}

| Type | Description |
|-|-|
| node | Node that matches the selector. |
[Table 2. Returns]

{#r_GDOC-getElement_S_O__table_wnz_fhs_pv}  
This example shows how to get the list view name value from a UI page.

    //HTML entry
    <input type="hidden" id="list_view" name="list_view" value="${sysparm_list_view}" />

    // Client script
    var listView = g_document.getElement('#list_view').value;

## GlideDocument - getElements(String selector, Element context) {#ariaid-title3}

Returns a node list found in the specified DOM based context or created if an HTML
context is specified.
{#r_GDOC-getElements_S_O__table_sh4_l3s_pv__entry__3}

| Name | Type | Description |
|-|-|-|
| selector | String or Object | The selector expression |
| context | String or Object | (Optional) A DOM Element, document, or JQuery object to be searched. |
[Table 3. Parameters]

{#r_GDOC-getElements_S_O__table_sh4_l3s_pv} {#r_GDOC-getElements_S_O__table_th4_l3s_pv__entry__2}

| Type | Description |
|-|-|
| node list | A list of nodes that matches the selector. |
[Table 4. Returns]

{#r_GDOC-getElements_S_O__table_th4_l3s_pv}

