JSFiddle - React, Tailwind, and code Playground

by hollanditkzn

HTML

<button data-title='Уверены', data-message='Что хотите нажать на кнопку' onclick="myConfirm('Сообщение', alert)">click me</button>

JavaScript

$('button').click(function(){
  let div=document.createElement('div');
  div.style.cssText="text-align:center;padding:10px;position:fixed;width:200px;height:40px;bottom:50%;right:50%;margin-right:-100px;margin-bottom:-20px;"
  console.log(div.onclick);
  div.onclick = function(e){
    var t=e?e.target:window.event.srcElement;
    if(t.tagName=='INPUT'){
      t.value=='Да' && console.log('yes');
      this.parentNode.removeChild(this);
    }
  }
  div.innerHTML='<div>'+$('button').data('title')+'<br/> '+$('button').data('message')+'<div><input type="button" value="Да"><input type="button" value="Нет">'
    return document.body.appendChild(div);
})