How do I display a simple alert in javascript without the title on top of the alert - Just a blank alert with just message.
1 Answer
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>
2 Comments
kojow7
This assumes the user is wanting to use jQuery rather than just JavaScript.
alert(), you display an appropriately styled<div>(or other HTML element(s)). Take a look at this question.alert(), but you can overridewindow.alertto customize it as you want !!!.