Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Javascript Prompt: best practice?

Tags:

javascript

I would like to prompt the user for some input on a webpage.

I can't use the builtin Javascript prompt function as it is creates security warnings in IE.

Is there a best practice/method/example that people use to recreate this?

The Javascript would need to be embedded in the page, so I'm looking at avoiding weighty external libraries.

like image 583
soupagain Avatar asked Dec 11 '25 01:12

soupagain


2 Answers

The easiest, most user-friendly approach would probably be to create a normal HTML form that you show with JavaScript in response to a click event on a link or button; you'd then hide the form after the data has been submitted.

like image 108
Ian Oxley Avatar answered Dec 13 '25 14:12

Ian Oxley


I'd steer away from prompts; they're obtrusive. You could render a form.

like image 45
Johannes Gorset Avatar answered Dec 13 '25 14:12

Johannes Gorset