<html>
<body>
<button id="dialog">Show Popup</button>
</body>
<script type="text/javascript">
var popUpList = $('<div><input type="radio">A<br><input type="radio">B<br><input type="radio">C</div>');
$("#dialog").click(function() {
popUpList.dialog();
});
</script>
</body>
</html>
0
A
ответ
0
Возможно, вам не хватает на импорт JQuery и пользовательский интерфейс
$(function() {
var popUpList = $('<div><input type="radio">A<br><input type="radio">B<br><input type="radio">C</div>');
$("#dialog").click(function() {
popUpList.dialog();
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<link href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css" rel="stylesheet" />
<script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
<button id="dialog">Show Popup</button>
-2
Пожалуйста, попробуйте:
popUpList.dialog("open");
+3
'autoOpen: true' по умолчанию, вам не нужно это делать. – Barmar
0
Вы должны захватить событие загрузки страницы, чтобы создать экземпляр объекта пользовательского интерфейса jQuery.
попробовать это:
<script type="text/javascript">
$(document).ready(function() {
var popUpList = $('<div><input type="radio" name="a">A<br><input type="radio" name="a">B<br><input type="radio" name="a">C</div>');
$("#dialog").click(function() {
popUpList.dialog();
});
});
</script>
ИЛИ
<script type="text/javascript">
$(function(){
// now we know that jQuery has been loaded and is ready.
});
</script>
B
C
Я пробую это, но его не могу показать диалоговое окно –
Пожалуйста, отредактируйте этот вопрос и описайте проблему, с которой вы сталкиваетесь. – Barmar