I am using an alert box to alert some messages after some validation. Now I want to make alert box position over the control where it had a validation error.
As a default, an alert box pops up in center of page, Now I want it at some custom position, for example I have 4 textbox to be validated, textbox-3 has some incorrect data, I want the alert to be presented just above the textbox-3 instead of center of page.
Is this possible to change the display behavior of alert box? If there's no other option to go for jquery dialog 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.
To style your alert box, you need to create a custom one first. The custom alert box will be created using jQuery and styles will be applied to CSS.
To set the width and height of an alert box in JavaScript, you need to use the custom alert box. This alert box is styled with CSS.
Since that is a default dialog box, you cannot position that. However, you can design your own custom alert box and position that. Or, you can use 3rd party dialog boxes, jquery ui has a nice one: http://jqueryui.com/dialog/
Jquery dialog box is the best option u get.Follow this:
http://jqueryui.com/dialog/
Is it possible to create a non-centered Javascript alert box?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With