JSFiddle - React, Tailwind, and code Playground
HTML
<a href="#enter-name">Click me!</a>
JavaScript
(
function ($)
{
$.fn.prompt =
function (options)
{
options = $.extend ({
title: 'Please enter',
fill: null,
callback: null
}, options);
return this.bind ('click',
function (e)
{
e.preventDefault ();
var data = window.prompt (options.title, options.fill);
if (options.callback)
{
options.callback.apply (this, [data])
}
}
);
}
}
)(jQuery);
$('a').prompt ({
title: 'Please fill in your name',
fill: '<name here>',
callback:
function (data)
{
$(this).text ('Welcome ' + data);
}
});