Check if the alert box has a sibling element, delete its parent if it doesn't exist

Steps:
1.Click the Create Network button
2.Enter 123 in the Allocation Pools
3.Then click on the Create button
4.When the page returns to the Create Network page,
click the Back button and then click the Next button,
you will find that the page content disappears.

Change-Id: I6210f6a1ada2826f83aa59318fb48f38da03cb89
Closes-Bug: #1804374
This commit is contained in:
pengyuesheng 2018-11-21 15:14:53 +08:00
parent c4515d1bf3
commit 0cf4df4a6f
1 changed files with 5 additions and 1 deletions

View File

@ -109,7 +109,11 @@ horizon.modals.init_wizard = function () {
}
// Clear old errors.
$form.find('div.row div.alert-danger').parent().remove();
if ($form.find('div.row div.alert-danger').siblings().length == 0) {
$form.find('div.row div.alert-danger').parent().remove();
} else {
$form.find('div.row div.alert-danger').remove();
}
$form.find('.form-group.has-error').each(function () {
var $group = $(this);
$group.removeClass('has-error');