Display Prompt box using JavaScript
Prompt box in JavaScript allows user to input in a textbox. Here we will see how we can show a prompt box using JavaScript.
<!DOCTYPE html>
<html>
<body>
<p>Display Prompted box using JavaScript</p>
<button onclick="showPromptBox()">Click here to see prompt box</button>
<p id="pId"></p>
<script>
function showPromptBox() {
var text;
var username = prompt("Please enter your username", "");
if (username == null || username == "") {
text = "User cancelled the prompt.";
} else {
text = "Hello !" + username + "Welcome to your SharePoint site";
}
document.getElementById("pId").innerHTML =text;
}
</script>
</body>
</html>
Great work! This is the type of information that should be shared around the web. Shame on the search engines for not positioning this post higher! Come on over and visit my site . Thanks =)