javascriptjqueryhtmlcss

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.


Solution

  • 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/