Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

copy text to clipboard javascript without input

navigator.clipboard.writeText('the text')
Comment

js copy input value to clipboard

<input type="text" placeholder="Create Password" id="text" readonly>
<script>
  function copyPassword(){
    var copyText = document.getElementById('text')
    copyText.select()
    copyText.setSelectionRange(0, 999)
    document.execCommand("copy")
    console.log(copyText);
  }
</script>
Comment

how to copy text from input through button click js

function copyToClipboard(element) {
  var $temp = $("<input>");
  $("body").append($temp);
  $temp.val($(element).text()).select();
  document.execCommand("copy");
  $temp.remove();
}
Comment

how to make work copy paste on otp input field javascript

var $inp = $(".passInput");

$inp.on({
 input: function(ev) {
  if(this.value) {
    $inp.eq($inp.index(this) + 1).focus();
  }
 },
 keydown: function(ev) {
  var i = $inp.index(this);
  if(ev.which===8 && !this.value && i) {
    $inp.eq(i - 1).focus();
  }
 },
 paste: function(e) {

    var pastedData = e.originalEvent.clipboardData.getData('text');
    var pastedChars = pastedData.split("");
    
    var curIndex = $inp.index(this)
    
    for (var i=0; i < pastedChars.length; i++) {
      var char = pastedChars[i]
      $inp.eq(curIndex + i).val(char).focus();
    }
 }
});
Comment

PREVIOUS NEXT
Code Example
Javascript :: node js delete array element 
Javascript :: javascript hover event listener 
Javascript :: autoplay images in react js 
Javascript :: window handles 
Javascript :: jquery select vs create syntax 
Javascript :: fetch devto api with api key 
Javascript :: swift urlsession remote json 
Javascript :: grouping related html form input 
Javascript :: cycle 2 
Javascript :: transform js to typescript 
Javascript :: onclick a hyperlink and display the id of clicked hyperlink js 
Javascript :: wordpress how to read jquery 
Javascript :: Compare a Boolean with another value 
Javascript :: jquery on mouseover and mouseout 
Javascript :: plumsail on change event value 
Javascript :: multiple variables in one live javascript 
Javascript :: Expo Location Error: Unhandled promise rejection: Error: Not authorized to use background location services 
Javascript :: javascrript Wrap all individual words in a span tag based on their first letter 
Javascript :: angularjs GetVideos API, Cant get the key parameter inside the array 
Javascript :: angularjs promise .then() to run sequentially inside a for loop 
Javascript :: AngularJS Pagination not showing all pages 
Javascript :: Json response reactnative fetch login data 
Javascript :: react js graph with more than one y axis 
Javascript :: perl and regular expression for text extraction pdf 
Javascript :: request submit form 
Javascript :: How To Use Matches() In JavaScript 
Javascript :: select random quotes from array called anecdotes 
Javascript :: phaser asteroid movement 
Javascript :: This Refers To The Window Object Here 
Javascript :: Second Simplest Promise Example 
ADD CONTENT
Topic
Content
Source link
Name
3+3 =