What do you want to save?
Add Code snippet
New code examples
-
Other 2022-03-05 12:20:02
copy clipboard with span
document.getElementById("cp_btn").addEventListener("click", copy_password); function copy_password() { var copyText = document.getElementById("pwd_spn"); var textArea = document.createElement("textarea"); ... Add solution -
Javascript 2022-02-27 23:00:02
js copy to clipboard cross browser
/** copy text to the clipboard */ function copy2clipboard( text, callback /* optional */ ) { // use modern clipboard API if ( navigator.clipboard ) { navigator.clipboard.writeText( text ) .then( function(){ // if a callback is provided, call it ... Add solution -
Javascript 2022-01-22 16:50:10
show selected text in textarea && activeElement
function onMouseUp(e) { const activeTextarea = document.activeElement; const selection = activeTextarea.value.substring( activeTextarea.selectionStart, activeTextarea.selectionEnd ); const outputElement = document.getElementById('output-eleme... Add solution -
Javascript 2021-09-10 12:02:04
copy text on click bootstrap
// Since Async Clipboard API is not supported for all browser! function copyTextToClipboard(text) { var textArea = document.createElement("textarea"); textArea.value = text document.body.appendChild(textArea); textArea.focus(); textAre... Add solution -
Javascript 2021-08-29 15:09:02
js window selection get new line
var userSelection function countLineBreaks(){ //Textarea var textarea = document.getElementById("textArea"); //Get user selection userSelection = (textarea.value).substring(textarea.selectionStart,textarea.selectionEnd); //Simpl... Add solution