Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

select not input elements text JS

document.querySelector('button').addEventListener('click', function(){
    var range = document.createRange();
    var selection = window.getSelection();
    range.selectNodeContents(document.querySelector('p')); // the element want to select it's content
    
    selection.removeAllRanges();
    selection.addRange(range);
});

// https://developer.mozilla.org/en-US/docs/Web/API/range/selectNodeContents
Comment

PREVIOUS NEXT
Code Example
Javascript :: nested loop javascript 
Javascript :: regex match but ignore part 
Javascript :: add atribut readonly on form js 
Javascript :: build class component react 
Javascript :: scriptable alert 
Javascript :: how to do multi ban discord.js 
Javascript :: angular deployment 
Javascript :: requiere and get a property simplified with Node 
Javascript :: full screen window open and disable all apps by javascript 
Javascript :: if strings in array 
Javascript :: how to send data from form with post axios in nuxt 
Javascript :: node.js sign in to website and get contents of new page 
Javascript :: how to change cursor color in vscode 
Javascript :: javascript findindex para objeto json 
Javascript :: how to find prime factors of a number in javascript 
Javascript :: string to number javascript shortcut 
Javascript :: trigger many url calls JS 
Javascript :: array object make api format javascript 
Javascript :: arrow function with computed property vue 
Javascript :: router unique validation for mongoose 
Javascript :: array of function 
Javascript :: check stored jwt expiration 
Javascript :: indexable values js 
Javascript :: acced to unknown obkect key js 
Javascript :: function expession js 
Javascript :: angular crud rest api medium 
Javascript :: jsondb 
Javascript :: Classes and constructor functions in ES6 
Javascript :: cypress contains regex 
Javascript :: regular expression for twitter embedded tweets 
ADD CONTENT
Topic
Content
Source link
Name
3+5 =