I
I
Igor Agarkov2018-02-04 19:07:24
css
Igor Agarkov, 2018-02-04 19:07:24

How to make a custom prompt?

Hey! I need a custom prompt. I was moving towards a regular modal, but the question arose of how to get the text back from the function that opens the modal. Like a native prompt, only with my appearance. Is it possible to do this somehow?
There is one more option. Open a modal with a field, and when you click on the OK button, do your dirty deeds. But this is somehow ugly, so it is considered as the last option.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
X
xmoonlight, 2018-02-04
@xmoonlight

alertifyjs.com
https://jsfiddle.net/wjw60em3/

var a=window.prompt;
window.prompt = function (message) {
  alert('Начали!');
  return a(message,'сюда вот...');
}

alert('Вы ввели: '+prompt('Введите текст'));

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question