2013-12-23 37 views
2

如何动态更改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> 
+0

http://stackoverflow.com/questions/14488774/using-html-in-a-dialogs-title-in-jquery-ui-1 -10这会帮助你 – Anup

回答

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

OR

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

这些都不为我工作。然而,这并...

$("#dlg").dialog("option","title","New Title").dialog('open');