Jquery UI dialog when used with form elements, its getting disappeared instantly. When I remove whole form tag contents, I see getting it closed only when user clicks on close button. Is Issue is with creating of div inside dialog which form elements are making it disappear?
Tried using css custom styles and Jquery .attr()
and .html()
to achive the same by overriding native alert.
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>jQuery UI Dialog - Default functionality</title>
<link rel="stylesheet" href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<link rel="stylesheet" href="httpsz:/resources/demos/style.css">
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script>
function displayalert()
{
$("<div>This is sample</div>").dialog();
}
</script>
</head>
<body>
<form>
<p>Select Items</p><br>
<input type="radio" name="checking">Item 1<br>
<input type="radio" name="checking">Item 2<br>
<input type="radio" name="checking">Item 3<br>
<input type="radio" name="checking">Item 4<br>
<input type="submit" onclick="displayalert()">
</form>
</body>
</html>
I have included alert to be displayed on button click. As stated when it is used alone, I see it closed only when user clicks on close. But when used with form, it disappears instantly.
I need the alert to get closed only when user clicks on close button.Have not included form contents since it is huge. It's having groups of radio buttons and checkboxes along with submit button.