How can I hide the password entered via a JavaScript dialog prompt?

前端 未结 9 1993
死守一世寂寞
死守一世寂寞 2020-12-01 07:44

How can I hide the password entered by a user in a dialog prompt in JavaScript? For example, using something like

var passwd = prompt(\"Enter Password : \",          


        
9条回答
  •  爱一瞬间的悲伤
    2020-12-01 08:30

    As of many answers you can't mask the input with a JavaScript prompt() but some alternative way to done this functionality using custom solution or use password input box instead.

    jQuery UI - Dialog Modal Form

    Use a modal dialog to require that the user enter data during a multi-step process. Embed form markup in the content area, set the modal option to true, and specify primary and secondary user actions with the buttons option.

    Ref : Dialog Modal Form

    jQuery Impromptu plugin

    Using html option you write html tags.

    Ref : Impromptu Plugin

    Using JavaScript

    Only by opening a little window containing a password form field:

    
    

    Ref : irt.org

提交回复
热议问题