Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Javascript alert position not in center in chrome

When I'm using an javascript alert it's going on top of the browser, not in center position in current version of chrome. How can I control it, and make it center with javascript. In firefox and IE,it's working just fine. My current chrome version 30.0.1599.66

I want to position the alert box in exact center of the browser for all type of browsers and for all versions. Please help........

Any other simple idea on providing alert so that it could be centered, would also be appreciable...

like image 625
AtanuCSE Avatar asked Oct 03 '13 05:10

AtanuCSE


People also ask

How do I center a JavaScript alert box?

Center the Alert Message Box Using CSS Under that, style it accordingly and position it to the center. Use the “top” and “left” CSS properties to achieve this. Set them as 50%, but as you can see the button below, so the property to 40% for correct alignment.

How do I change the position of the alert box in HTML?

To customize the position of an alert box, use the CSS “top” and “left” properties. We have a custom alert box, which we've created using jQuery and styled with CSS.

Why alert is not working in JavaScript?

The reason alert() does not work is because previously you have checked "prevent this page from creating additional dialoug" checkbox. lets take a look at this code. There will be two alert boxes if you run the code.


2 Answers

Being dependent upon the browsers for the alerts is not a good choice for any. They change rapidly and are not the same for different browsers.

What i have found useful is to use Alertify JS for all the alert needs. You can customize it for your needs and it looks fabulous anyway.

like image 145
Vikram Tiwari Avatar answered Sep 21 '22 01:09

Vikram Tiwari


Since it is a default box, u cannot position it, though u can create your own and position it accordingly.. try this http://jqueryui.com/dialog/

like image 31
Manu Avatar answered Sep 19 '22 01:09

Manu