Elementals.js

Latest Version: 2.0 RC 3 14 March 2017

Method _.nodeAddSelectButton

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:
_.nodeAddSelectButton(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 _.nodeAdd for more information.

Returns:
Nothing

Example #1

HTML

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

JavaScript

_.nodeAddSelectButton(_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.