Hello guys I know that is probably a stupid question but i had to be sure after all. Can i add an input of type password in a prompt box? prompt box is a one of javascript\
No, you can't.
The popup is browser controlled and can't be changed.
As the documentation shows, you can only supply a message and default text.
You can use javascript to create your own overlay that simulates a prompt popup.
See the jQuery UI Dialog for ideas and examples.
If you literally mean the prompt function, you can't. What you can do instead is pop up a div
or similar above the main content of your page (using absolute positioning and a z-index
value) and put the password box in there.
More in the various answers to these questions:
There are a variety of libraries you can use that will do the hard work for you (not that it's that hard, but still). If you're already using a library like jQuery, Prototype, YUI, Closure, or any of several others, you may find that there's a plug-in designed for use with that library (jQuery UI for jQuery, for instance). If not, there are plenty of stand-alone implementations. Look for "light box" or "lightweight window" or "JavaScript dialog box", etc.
Note that any of these will require a bit of a change to the logic of your code, since prompt
brings the browser and your script to a screeching halt until the prompt is dismissed by the user, whereas this mechanism of flying an element over the top of the content is, by its nature, asynchronous.