// As jquery plugin
$(selector).fieldSelection(); // {start: xxx, end: xxx, length: xxx, text: xxx}
// As commonjs module
var fieldSelection = require('field-selection');
fieldSelection.get(element);
// Via window global.
window.fieldSelection.get(element);
// As jquery plugin
$(selector).fieldSelection('My text');
// As commonjs module
var fieldSelection = require('field-selection');
fieldSelection.replace(element, 'new text');
// Via window global.
window.fieldSelection.replace(element, 'new text');