Elementals.js

Latest Version: 3.7 Final 20 December 2018

Method _.Node.addSelectButton

Summary:

Adds a button to the page that when clicked selects the contents of the associated DOM element as if you had done so by clicking and dragging the mouse.

Calling Convention:
_.Node.addSelectButton(Element[, text[, node[, place]]])
Parameters:
Element
The target Element that will be selected when the new button is clicked.
text optional
The text to be placed inside the button. If omitted, 'select' will be used.
Node optional
The element the new button is to be added to the DOM relative to. If omitted, Element.parentNode will be used.
place optional

Where the element will be placed. If place is omitted or invalid, 'before' is used. See DOM_JON Replacement Commands for more information.

Returns:
Nothing

Example #1

HTML

<div id="test">Test</h1>

JavaScript

_.Node.addSelectButton(_d.getElementById('test'));

Inserts a <button>select</button> before div#test that when clicked selects the contents of that element.


A live example of this method can be found in our demonstrations section.