Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to customize the position of an alert box

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.

like image 630
Aakash Avatar asked Sep 24 '13 10:09

Aakash


People also ask

How do I change the position of the 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.

Can we customize alert box?

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.

How do I increase the size of my alert box?

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.


2 Answers

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/

like image 168
Kuzgun Avatar answered Sep 27 '22 21:09

Kuzgun


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?

like image 24
choudhury smrutiranjan parida Avatar answered Sep 27 '22 22:09

choudhury smrutiranjan parida