title: How to change div title using jquery
body: <p>I have the following code:</p>
  
  <pre><code>&lt;div id="DivPassword" title="test" &gt; 
  </code></pre>
  
  <p> </p>
  
  <p>I want to change the div title and I have the following code:</p>
  
  <pre><code> function ChangeAttribute() {
           $("#DivPassword")
              .attr('title', 'Photo by Kelly Clark');
           $('#DivPassword').dialog('open');
           return false;
       }
  </code></pre>
  
  <p>When the dialog is opened, the title is still test! if I don't assign any title to the div, the dialog doesn't show any title.  How can I correct that?</p>
  
  <hr>
  
  <pre><code> function ChangeAttribute() {
           $("#DivPassword")
              .attr('title', 'Photo by Kelly Clark')
              .dialog('open');
  
           alert($("#DivPassword").attr('title'));
       }
  
  $('#DivPassword').dialog({
               autoOpen: false,
               width: 800,
               buttons: {
                   "Cancel": function() {
                       $(this).dialog("close");
                   },
                   "Accept": function() {
                   alert($(this).attr('title'));
                       $(this).dialog("close");
                   }
               }
           });
  </code></pre>
  
  <hr>
  
  <pre><code> &lt;script type="text/javascript"&gt;
       var Dtitle;
       $(function() {
          $('#DivPassword').dialog({
  
               autoOpen: false,
               width: 800,
               title : Dtitle,
               buttons: {
                   "Cancel": function() {
                       $(this).dialog("close");
                   },
                   "Accept": function() {
                       $(this).dialog("close");
                   }
               }
           });
       });
  
       function ChangeAttribute(name) {
           $("#DivPassword")
              .attr('title', name)
              .dialog('open');
           Dtitle = $("#DivPassword").attr('title');
           alert(Dtitle);
       }
  
  
  &lt;/script&gt;
  </code></pre>