1

How do I display a simple alert in javascript without the title on top of the alert - Just a blank alert with just message.

3
  • 2
    You don't use alert(), you display an appropriately styled <div> (or other HTML element(s)). Take a look at this question. Commented Apr 30, 2017 at 6:06
  • Possible duplicate of How to edit a JavaScript alert box title? Commented Apr 30, 2017 at 6:09
  • No it is impossible to change Title you can just pass the message to alert(), but you can override window.alert to customize it as you want !!!. Commented Apr 30, 2017 at 6:20

1 Answer 1

2

It is not possible with browser's native alert box. However you can always use JavaScript alert box.

  function showAlert(){
    $( "#dialog" ).dialog({modal: true});
}
  <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">

<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>

<body>
<input type="button" value="Alert" onClick='showAlert()'>
<div id="dialog" title="" style="display: none;">
  <p>Alert box. Lorem Ipsum.</p>
</div>
 
</body>

Sign up to request clarification or add additional context in comments.

2 Comments

This assumes the user is wanting to use jQuery rather than just JavaScript.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.