jquery 动态对话框标题

标签 jquery

如何动态更改 jquery 对话框标题,这是我们正在使用的代码,它将显示正常标题,但我们必须根据代码进行更新。

<!doctype html>
<html lang="en">
 <head>
   <meta charset="utf-8">
<title>jQuery UI Dialog - Default functionality</title>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css">
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>

<script>
$(function() {
  $( "#dialog" ).dialog();
 });
  </script>
 </head>
<body>

 <div id="dialog" title="Basic dialog">
     <p>This is the default dialog which is useful for displaying information.</p>
   </div>


   </body>
   </html>

最佳答案

$('#dialog').attr('title', 'New Title').dialog();

或者

$( "#dialog" ).dialog({ title: "New Dialog Title" });

关于jquery 动态对话框标题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20741524/

相关文章:

php - 如何让超链接将 2 个数组值传递给另一个脚本并打印该脚本的页面?

javascript - 如何从指定偏移量计算鼠标移动距离

javascript - jQuery - 表单验证是迟到的一件事

javascript - jquery 切换附加删除

javascript - DataTables (JQuery) 如何对给定包含数据的数组进行多列过滤文本框?

javascript - 禁用输入类型=按钮的标签

javascript - 如何将 DataTables 按钮定位到浏览器的右上角?

javascript - 单击链接时停止拖动事件

javascript - 使用相同的 ajax 调用打开多个动态链接

javascript - 限制/禁用/启用复选框