---
schema_version: "1"
id: e0081d747c3a3a45d4e98ce61a95a88341b2738658b158c98aebda6ea0c33cc2
title: Select Marks
collection: tableau
version: next
locale: en-us
portal_url: https://docs.salesforce.com/tableau/next/en-us/api/js_api/JavaScriptAPI/js_api_sample_select_marks.md
canonical_url: https://help.tableau.com/v0.0/api/js_api/en-us/JavaScriptAPI/js_api_sample_select_marks.htm
source_site: help.tableau.com
content_type: documentation
content_hash: 7efbc34f868cd41caeb0375c52b588aaa0e625e05d2d0521149b5aeff19fe478
description: Important changes for the Tableau JavaScript API
---
[Skip to main content](#main-content)

# Select Marks

**Important changes for the Tableau JavaScript API**

As of February 2024, the Tableau JavaScript API is deprecated. Use the Embedding API v3 instead for embedding interactive views into web pages and applications. For guidance on embedding Tableau views, see the [Tableau Embedding API v3 Help](https://help.tableau.com/current/api/embedding_api/en-us/index.html).

Select a set of marks in a visualization.

Select marks Add to the selection Clear all

* * *

  

```
<!DOCTYPE html>
<html>

<head>
    <title>Select Marks</title>

    <script type="text/javascript"
        src="https://public.tableau.com/javascripts/api/tableau-2.min.js"></script>

    <script type="text/javascript">
        var viz, sheet;

        function initViz() {
            var containerDiv = document.getElementById("vizContainer"),
                url = "http://public.tableau.com/views/RegionalSampleWorkbook/College",
                options = {
                    "Academic Year": "",
                    hideTabs: true,
                    onFirstInteractive: function () {
                        sheet = viz.getWorkbook().getActiveSheet();
                    }
                };

            viz = new tableau.Viz(containerDiv, url, options);
        }

        function selectCollege(college_name) {
            sheet.selectMarksAsync("College", college_name, tableau.SelectionUpdateType.REPLACE);
        }

        function addCollegeToSelection(college_name) {
            sheet.selectMarksAsync("College", college_name, tableau.SelectionUpdateType.ADD);
        }

        function clearCollegeSelection() {
            sheet.clearSelectedMarksAsync();
        }
    </script>
</head>

<body onload="initViz();">
	<div id="vizContainer"></div>
    <br />
    <button onclick="selectCollege('Engineering');">Select a value</button>
    <button onclick="addCollegeToSelection('Business');">Add to the selection</button>
    <button onclick="clearCollegeSelection();">Clear all</button>
</body>

</html>
```