[英]how to display alert message box with radio button in javascript
<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>
Possibly you are missing the imports of jQuery and ui 可能您缺少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>
You have to capture the page load event to instantiate a jQuery UI object. 您必须捕获页面加载事件才能实例化jQuery UI对象。
try this: 尝试这个:
<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>
OR 要么
<script type="text/javascript">
$(function(){
// now we know that jQuery has been loaded and is ready.
});
</script>
请试试 :
popUpList.dialog("open");
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.