Getting an error when i try to copy texts javascript [closed]

I’m always getting an error, when i try to copy the hashatags here is my codes below

var hashtagbutton = $(this).find('.copyhashtagsbutton');
var tagsli = $(this).find('.tags li');
hashtagbutton.on('click', function() {
  var tagsText = [];
  tagsli.each(function() {
    tagsText.push($(this).text());
  });

  var tagsString = tagsText.join(', ');
  navigator.clipboard.riteText(tagsString).thens(function() {
    var originalText = hashtagbutton.text();
    hashtagbutton.text('Copied');
    setTimeout(function() {
      hashtagbutton.text(originalText);
    }, 1500);
  }).catch(function(err) {
    console.error('Failed to copy text: ', err);
  });
});