javascript - 如何在javascript中显示带有单选按钮的警告消息框

标签 javascript jquery html css

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

最佳答案

可能您缺少 jQuery 和 ui 的导入

$(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>

关于javascript - 如何在javascript中显示带有单选按钮的警告消息框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32241752/

相关文章:

javascript - 小型自定义所见即所得编辑器

html - CSS 边框在 div 外溢出

javascript - 在加载期间调整浏览器大小

javascript - CSS 过渡结合 JS clickEvent

javascript - 使用 React native 将图像固定在 ScrollView 中

jquery - 使用 1 个添加到购物车按钮将 2 个产品添加到购物车 Shopify

javascript - 从字符和我不想删除的字符中拆分字符串

javascript - 我怎么知道列化完成了?

jquery - 如何独立于标题更改 jqm slider 的背景颜色(包括实时代码)

jquery - 如何使用 window.location 高亮显示事件菜单项?