This question already has an answer here:
i want to take input password in java script prompt box but it only take input as string which is visible now how i can take input password in same text field. is there any way to change this text field from input type text to password without div
this is what i have already tried
prompt("enter password");
here is example
can any one suggest me how i can do this using j query or java script
No, you can't.
The popup is browser controlled and can't be changed.
you can use javascript dialog box for it
HTML CODE
<div id="dialog" title="Basic dialog"> <input type="password" size="25" /> </div>
JAVASCRIPT CODE
$( "#dialog" ).dialog();
DEMO
prompt is native browser functionality, and therefore not very flexible. Unfortunately, you cannot mask the input from a prompt.
Alternatively, you can use the input element with the password type:
<input type="password" size="25" />
And show this in a custom modal window. An input element with the type="password" attribute set, will automatically mask the entered characters. On how to embed this in a modal, there are many possibilities. If you are using jQuery, you might want to consider using jQuery UI for this: http://jqueryui.com/dialog/