简体   繁体   中英

Javascript Prompt: best practice?

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.

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.

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

I use jQuery plugin Impromptu . It's nice and unobtrusive and sufficiently lightweight.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM